aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlbinding/data
diff options
context:
space:
mode:
authorOlivier JG <olivier.de.gaalon@kdab.com>2016-12-16 09:57:37 -0600
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2017-05-17 09:23:39 +0000
commit4425d6f9b637e7404379b611cef4b22929acbe62 (patch)
treeceaa670ee0efc6ed3a455aa18a6ec0784854629d /tests/auto/qml/qqmlbinding/data
parentdc3015e891e903e6f701f1abc303be9f2efc2e5a (diff)
QML: emit messages when breaking bindings
Add a new logging category that can be used to debug issues with unexpected binding breakages caused by assignment to previously bound properties. If enabled, outputs a message when a binding is broken with detailed location and property/value information. [ChangeLog][QtQml] The QML engine can now emit informational messages (in the "qt.qml.binding.removal" logging category) whenever a binding is lost due to an imperative assignment. This can be used to debug issues due to broken bindings. Change-Id: Ie31e5a198450b6f998c1266acfc97e8f33a92e3d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlbinding/data')
-rw-r--r--tests/auto/qml/qqmlbinding/data/bindingOverwriting.qml13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlbinding/data/bindingOverwriting.qml b/tests/auto/qml/qqmlbinding/data/bindingOverwriting.qml
new file mode 100644
index 0000000000..767ca0c719
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/data/bindingOverwriting.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.9
+
+Text {
+ visible: text && enabled
+ enabled: font.pixelSize === 25
+ font: enabled ? Qt.font({ "pixelSize": 25 }) : Qt.font({ "pixelSize": 50 })
+
+ Component.onCompleted: {
+ enabled = Qt.binding(function() { return visible; }); // replacement binding, not breaking
+ visible = true; // breaks visible binding
+ font.bold = true; // breaks font binding
+ }
+}