summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qproperty.cpp
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2021-04-21 12:52:49 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-15 18:25:39 +0000
commitf55d572a5949e8f0ef0fcd605be389e97de32dca (patch)
tree70d37256373d1368a2c84994e75e82958d3ff4c2 /src/corelib/kernel/qproperty.cpp
parentee21938a3a274bc3094e84d0726ad494b2db4318 (diff)
Bindable property docs: mention virtual setters and getters
Update the bindable property docs to explain how to deal with virtual getters and setters. Task-number: QTBUG-92994 Change-Id: I6c29011817e83623414b39afee0f39ad4cc5c1c9 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit c0716994f3a089b41b5a3d05372f4fc2fb4f51c9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/kernel/qproperty.cpp')
-rw-r--r--src/corelib/kernel/qproperty.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp
index bff65cd165..d290f0a16c 100644
--- a/src/corelib/kernel/qproperty.cpp
+++ b/src/corelib/kernel/qproperty.cpp
@@ -1425,6 +1425,31 @@ QString QPropertyBindingError::description() const
be analyzed carefully to comply with the rules given in
\l {Writing to a Bindable Property}.
+ \section2 Properties with Virtual Setters
+
+ Some of the pre-existing Qt classes (for example, \l QAbstractProxyModel)
+ have properties with virtual setters. Special care must be taken when
+ making such properties bindable.
+
+ For the binding to work properly, the property must be correctly handled in
+ all reimplemented methods of each derived class.
+
+ Unless the derived class has access to the underlying property object, the
+ base implementation \e must be called for the binding to work correctly.
+
+ If the derived class can directly access the property instance, there is no
+ need to explicitly call the base implementation, but the property's value
+ \e must be correctly updated.
+
+ Refer to \l {Bindable Properties with Virtual Setters and Getters} for more
+ details.
+
+ In both cases the expected behavior \e must be documented in the property's
+ documentation, so that users can correctly override the setter.
+
+ Properties for which these conditions cannot be met should not be made
+ bindable.
+
\sa Q_OBJECT_COMPAT_PROPERTY, QObjectBindableProperty, {Qt's Property System}, {Qt Bindable
Properties}
*/