diff options
author | Robin Burchell <robin.burchell@crimson.no> | 2017-01-18 16:26:43 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@crimson.no> | 2017-03-15 22:11:31 +0000 |
commit | 34ff6c40c1a03f51bc259e57cffb02ad69c7663b (patch) | |
tree | acae6098eb50fd44506c404aa2bfc6c40f9ca203 /src/qml/qml/qqmltypewrapper_p.h | |
parent | 212ccd59627deb8c06227dbf0f3f3329006c326e (diff) |
qml: Override the new Object::instanceOf hook to allow QML type checking
[ChangeLog][QtQml] The instanceof keyword in JavaScript has been
extended to work on QML types and instances. This means that you are now
able to use it to verify that a var is indeed the type you expect (e.g.
someVar instanceof Rectangle).
Note that one of the added tests revealed a slight shortcoming in the
QML type system (QTBUG-58477). For now, we should keep consistency and
work to address the problem universally in the future.
Change-Id: I7d9bf9b64cfd037908de1ae51b01065eacb95abe
Task-number: QTBUG-24799
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltypewrapper_p.h')
-rw-r--r-- | src/qml/qml/qqmltypewrapper_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/qml/qqmltypewrapper_p.h b/src/qml/qml/qqmltypewrapper_p.h index cfb6cb0ec9..c584458ed4 100644 --- a/src/qml/qml/qqmltypewrapper_p.h +++ b/src/qml/qml/qqmltypewrapper_p.h @@ -103,7 +103,7 @@ struct Q_QML_EXPORT QmlTypeWrapper : Object static bool put(Managed *m, String *name, const Value &value); static PropertyAttributes query(const Managed *, String *name); static bool isEqualTo(Managed *that, Managed *o); - + static ReturnedValue instanceOf(const Object *typeObject, const Value &var); }; } |