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 /tests/auto/qml/qqmllanguage/data/instanceof_qtqml.qml | |
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 'tests/auto/qml/qqmllanguage/data/instanceof_qtqml.qml')
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/instanceof_qtqml.qml | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/instanceof_qtqml.qml b/tests/auto/qml/qqmllanguage/data/instanceof_qtqml.qml new file mode 100644 index 0000000000..d74b172cf8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/instanceof_qtqml.qml @@ -0,0 +1,13 @@ +import QtQml 2.0 + +QtObject { + id: qtobjectInstance + + property Timer aTimer: Timer { + id: timerInstance + } + + property Connections aConnections: Connections { + id: connectionsInstance + } +} |