aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlproperty/data
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2019-07-22 13:41:11 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2019-07-22 16:00:52 +0200
commitda14688140550879e376e71cf273b16494e6c3c4 (patch)
tree6f7e77721b1277f4039ea1e7dd0c64d5f81fefab /tests/auto/qml/qqmlproperty/data
parentb0e19e1d08e17a7fd76008447be0f788ebf73f1f (diff)
Fix nullptr handling in binding
Fixes: QTBUG-77027 Change-Id: I61d5a20329ffe95af810b89e338eee2bc10bfe04 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlproperty/data')
-rw-r--r--tests/auto/qml/qqmlproperty/data/nullPropertyBinding.qml22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlproperty/data/nullPropertyBinding.qml b/tests/auto/qml/qqmlproperty/data/nullPropertyBinding.qml
new file mode 100644
index 0000000000..4fffc7aead
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/nullPropertyBinding.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.12
+
+Item {
+ id: root
+
+ width: 640
+ height: 480
+
+ property bool toggle: false
+ property Item bound
+ property string message: "defined"
+
+ readonly property Item item: root.toggle ? root : null
+
+ Binding { target: root; property: "bound"; value: item}
+
+ function tog() {
+ console.info(root.bound ? root.bound.message: "undefined")
+ root.toggle = !root.toggle
+ return 42;
+ }
+}