aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc
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 /src/qml/doc
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 'src/qml/doc')
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc b/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc
index f28ff5082a..99426d984d 100644
--- a/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc
@@ -179,6 +179,26 @@ Rectangle {
Now, after the space key is pressed, the rectangle's height will continue
auto-updating to always be three times its width.
+\section3 Debugging overwriting of bindings
+
+A common cause of bugs in QML applications is accidentally overwriting bindings
+with static values from JavaScript statements. To help developers track down
+problems of this kind, the QML engine is able to emit messages whenever a
+binding is lost due to imperative assignments.
+
+In order to generate such messages, you need to enable the informational output
+for the \c{qt.qml.binding.removal} logging category, for instance by calling:
+
+\code
+QLoggingCategory::setFilterRules(QStringLiteral("qt.qml.binding.removal.info=true"));
+\endcode
+
+Please refer to the QLoggingCategory documentation for more information about
+enabling output from logging categories.
+
+Note that is perfectly reasonable in some circumstances to overwrite bindings.
+Any message generated by the QML engine should be treated as a diagnostic aid,
+and not necessarily as evidence of a problem without further investigation.
\section2 Using \c this with Property Binding