From 57b4e30ff8841da682cc5e27c2b4abf571838e32 Mon Sep 17 00:00:00 2001 From: Jaishree Vyas Date: Tue, 28 Jun 2022 14:01:05 +0200 Subject: [PATCH] Write QProperty use in QML Details: Added a note on how QProperty works in QML using BINDABLE keyword Task-number: QTBUG-89166 Change-Id: Ib48dd26b0724f906efa65d14fbb75a8b97255b05 Reviewed-by: Fabian Kosmale --- src/corelib/kernel/qproperty.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp index 482ed3bf350..a635cb8afce 100644 --- a/src/corelib/kernel/qproperty.cpp +++ b/src/corelib/kernel/qproperty.cpp @@ -1175,6 +1175,17 @@ QString QPropertyBindingError::description() const dynamically, the binding expression. It is represented as a C++ lambda and can be used to express relationships between different properties in your application. + + \note In the case of QML it is important that \l QProperty needs to be exposed + in \l Q_PROPERTY with the BINDABLE keyword. As a result the QML engine, uses it + as the bindable interface to set up the property binding. In turn, the binding + can be then interacted with C++ via the normal API like: + + QProperty::onValueChanged, QProperty::takeBinding and QBindable::hasBinding + + If the property is BINDABLE, then the engine will use the change-tracking + inherent to the C++ property system for getting notified about changes; and + won't rely on signals being emitted. */ /*!