aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlbinding/data
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2023-04-14 14:29:19 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2023-04-19 20:01:09 +0200
commit82f2ee8027f733cec5961aac27a171cf0b78a70b (patch)
tree4712029a1290694934c56dab4de031a56767d2c9 /tests/auto/qml/qqmlbinding/data
parent3bd201c4da03132354805e220577014e813659ba (diff)
Binding: Reevaluate when before the target changes
...and do not warn about missing properties if when is disabled. Besides avoiding spurious warnings, this also avoids modifying a property only to restore its binding/value directly afterwards. Note that when the binding gets re-enabled, we still trigger the warning. Fixes: QTBUG-112860 Pick-to: 6.5 Change-Id: I5ddd32f2de2dec9da372b08ab4bb5bdb88873e51 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/qml/qqmlbinding/data')
-rw-r--r--tests/auto/qml/qqmlbinding/data/whenEvaluatedEarlyEnough.qml23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlbinding/data/whenEvaluatedEarlyEnough.qml b/tests/auto/qml/qqmlbinding/data/whenEvaluatedEarlyEnough.qml
new file mode 100644
index 0000000000..6245270e14
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/data/whenEvaluatedEarlyEnough.qml
@@ -0,0 +1,23 @@
+import QtQuick
+
+Item {
+ id: root
+ property bool toggle: true
+ property bool forceEnable: false
+
+ Item {
+ id: item1
+ property int i
+ }
+
+ Item {
+ id: item2
+ }
+
+ Binding {
+ target: root.toggle ? item1 : item2
+ when: root.forceEnable || (root.toggle ? item1 : item2).hasOwnProperty("i")
+ property: "i"
+ value: 42
+ }
+}