aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlnotifier/data
diff options
context:
space:
mode:
authorThomas McGuire <thomas.mcguire@kdab.com>2012-07-17 17:35:53 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-22 12:25:33 +0200
commit26ea8e01e9ee2a8c8c09266147b94c9ac92d09f9 (patch)
treec058873b0082b18a09dde27f7ee124285e696807 /tests/auto/qml/qqmlnotifier/data
parent2cc57f1e33cc4d739b1b76c605e6241fa0f134a8 (diff)
Make connectNotify() work with QML
Call connectNotify() and disconnectNotify() in QQmlNotifierEndPoint, which works for QML signal handlers and for QML bindings. Task-number: QTBUG-11284 Change-Id: Ic9a08ee6687e5c7e606f315c8fb30eec1493cd83 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlnotifier/data')
-rw-r--r--tests/auto/qml/qqmlnotifier/data/connectnotify.qml73
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlnotifier/data/connectnotify.qml b/tests/auto/qml/qqmlnotifier/data/connectnotify.qml
new file mode 100644
index 0000000000..35226ee5ab
--- /dev/null
+++ b/tests/auto/qml/qqmlnotifier/data/connectnotify.qml
@@ -0,0 +1,73 @@
+import QtQuick 2.0
+import Test 1.0
+
+Item {
+ id: root
+ ExportedClass {
+ id: exportedClass
+ objectName: "exportedClass"
+ onBoundSignal: {}
+ }
+
+ property int v4Binding: exportedClass.v4BindingProp
+
+ property int v8Binding: {
+ Math.abs(12); // Prevent optimization to v4
+ return exportedClass.v8BindingProp
+ }
+
+ property int scriptBinding: {
+ function innerFunction() {} // Prevent usage of v4 or v8 bindings
+ return exportedClass.scriptBindingProp
+ }
+
+ property int foo: exportedClass.qmlObjectProp
+ property int baz: _exportedObject.cppObjectProp
+
+ // v4 bindings that could share a subscription. They don't, though, and the code
+ // relies on that
+ property int v4Binding2: exportedClass.v4BindingProp2
+ property int bla: exportedClass.v4BindingProp2
+
+ function removeV4Binding() {
+ //console.log("Going to remove v4 binding...")
+ root.v4Binding = 1;
+ //console.log("Binding removed!")
+ }
+
+ function removeV8Binding() {
+ //console.log("Going to remove v8 binding...")
+ root.v8Binding = 1;
+ //console.log("Binding removed!")
+ }
+
+ function removeScriptBinding() {
+ //console.log("Going to remove script binding...")
+ root.scriptBinding = 1;
+ //console.log("Binding removed!")
+ }
+
+ function removeV4Binding2() {
+ //console.log("Going to remove v4 binding 2...")
+ root.v4Binding2 = 1;
+ //console.log("Binding removed!")
+ }
+
+ function readProperty() {
+ var test = exportedClass.unboundProp
+ }
+
+ function changeState() {
+ //console.log("Changing state...")
+ if (root.state == "") root.state = "state1"
+ else root.state = ""
+ //console.log("State changed.")
+ }
+
+ property int someValue: 42
+
+ states: State {
+ name: "state1"
+ PropertyChanges { target: root; someValue: exportedClass.unboundProp }
+ }
+}