From 4fb96669e33c9e1e3edc1cf2e472f921ddee6484 Mon Sep 17 00:00:00 2001 From: Patrick Stewart Date: Wed, 9 Nov 2022 00:30:42 +0000 Subject: QBindable: Make ordinary Q_PROPERTYs bindable Implements an adaptor from the notification signal of a Q_PROPERTY to QBindable. The Q_PROPERTY does not need to be BINDABLE, but can still be bound or used in a binding. [ChangeLog][Core][Q_PROPERTY] Q_PROPERTYs without BINDABLE can be wrapped in QBindable to make them usable in bindings Change-Id: Id0ca5444b93a371ba8720a38f3607925d393d98a Reviewed-by: Fabian Kosmale --- src/corelib/doc/src/objectmodel/bindableproperties.qdoc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/corelib/doc') diff --git a/src/corelib/doc/src/objectmodel/bindableproperties.qdoc b/src/corelib/doc/src/objectmodel/bindableproperties.qdoc index f9f129df97..d6f96f6579 100644 --- a/src/corelib/doc/src/objectmodel/bindableproperties.qdoc +++ b/src/corelib/doc/src/objectmodel/bindableproperties.qdoc @@ -247,4 +247,18 @@ be called for the current value of the property, register your callback using subscribe() instead. + \section1 Interaction with Q_PROPERTYs + + A \l {The Property System}{Q_PROPERTY} that defines \c BINDABLE can be bound and + used in binding expressions. You can implement such properties using \l {QProperty}, + \l {QObjectBindableProperty}, or \l {QObjectComputedProperty}. + + Q_PROPERTYs without \c BINDABLE can also be bound and be used in binding expressions, + as long as they define a \c NOTIFY signal. You must wrap the property in a \l QBindable + using the \c {QBindable(QObject* obj, const char* property)} constructor. Then, the + property can be bound using \c \l QBindable::setBinding() or used in a binding + expression via \c \l QBindable::value(). You must use \c QBindable::value() in binding + expressions instead of the normal property \c READ function (or \c MEMBER) to enable + dependency tracking if the property is not \c BINDABLE. + */ -- cgit v1.2.3