aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.12.qml
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2012-05-11 17:37:07 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-24 05:52:32 +0200
commit4709f30b26042427b225dd164648e3f5907c9d33 (patch)
tree3edac8d14d3fb77406ef93aa2c34c42131109625 /tests/auto/qml/qqmlecmascript/data/propertyQJSValue.12.qml
parent2542778d4837143a61dfcf143c32683acc8b998a (diff)
Enable binding to properties of type QJSValue.
This allows javascript objects of all types to be bound to properties declared in c++. Compared to a QVariant the primary benefit this offers is a type which functions and objects with functions can be bound to. Change-Id: Idb3313e7ff1d616ab12d44f616083c8296201f3a Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/data/propertyQJSValue.12.qml')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.12.qml26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.12.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.12.qml
new file mode 100644
index 0000000000..78390a0a6d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.12.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ property bool test: false
+
+ MyQmlObject { id: nullOneObj; qjsvalue: null }
+ MyQmlObject { id: nullTwoObj; }
+ MyQmlObject { id: undefOneObj; qjsvalue: undefined }
+ MyQmlObject { id: undefTwoObj }
+
+ property alias nullOne: nullOneObj.qjsvalue
+ property alias nullTwo: nullTwoObj.qjsvalue
+ property alias undefOne: undefOneObj.qjsvalue
+ property alias undefTwo: undefTwoObj.qjsvalue
+
+ Component.onCompleted: {
+ nullTwo = null;
+ undefTwo = undefined;
+ if (nullOne != null) return;
+ if (nullOne != nullTwo) return;
+ if (undefOne != undefined) return;
+ if (undefOne != undefTwo) return;
+ test = true;
+ }
+}