Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
\macro Q_OBJECT_BINDABLE_PROPERTY(containingClass, type, name, signal) More...
#include <qproperty_p.h>
Public Types | |
using | value_type = typename QPropertyData<T>::value_type |
using | parameter_type = typename QPropertyData<T>::parameter_type |
using | arrow_operator_result = typename QPropertyData<T>::arrow_operator_result |
Public Types inherited from QPropertyData< T > | |
using | value_type = T |
using | parameter_type = std::conditional_t<UseReferences, const T &, T> |
using | rvalue_ref = typename std::conditional_t<UseReferences, T &&, DisableRValueRefs> |
using | arrow_operator_result |
Friends | |
template<typename Property , typename > | |
class | QtPrivate::QBindableInterfaceForProperty |
Additional Inherited Members | |
Protected Attributes inherited from QPropertyData< T > | |
T | val = T() |
Static Protected Attributes inherited from QPropertyData< T > | |
static constexpr bool | UseReferences = !(std::is_arithmetic_v<T> || std::is_enum_v<T> || std::is_pointer_v<T>) |
\macro Q_OBJECT_BINDABLE_PROPERTY(containingClass, type, name, signal)
Declares a \l QObjectBindableProperty inside containingClass of type type with name name. If the optional argument signal is given, this signal will be emitted when the property is marked dirty.
\macro Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(containingClass, type, name, initialvalue, signal)
Declares a \l QObjectBindableProperty inside containingClass of type type with name name which is initialized to initialvalue. If the optional argument signal is given, this signal will be emitted when the property is marked dirty.
\inmodule QtCore
The QObjectCompatProperty class is a template class to help port old properties to the bindable property system.
QObjectCompatProperty is a generic container that holds an instance of T
and behaves mostly like QProperty, just like QObjectBindableProperty. It's one of the Qt internal classes implementing \l {Qt Bindable Properties}. Like QObjectBindableProperty, QObjectCompatProperty stores its management data structure in the surrounding QObject. The last template parameter specifies a method (of the owning class) to be called when the property is changed through the binding. This is usually a setter.
As explained in \l {Qt Bindable Properties}, getters and setters for bindable properties have to be almost trivial to be correct. However, in legacy code, there is often complex logic in the setter. QObjectCompatProperty is a helper to port these properties to the bindable property system.
With QObjectCompatProperty, the same rules as described in \l {Bindable Property Getters and Setters} hold for the getter. For the setter, the rules are different. It remains that every possible code path in the setter must write to the underlying QObjectCompatProperty, otherwise calling the setter might not remove a pre-existing binding, as it should. However, as QObjectCompatProperty will call the setter on every change, the setter is allowed to contain code like updating class internals or emitting signals. Every write to the QObjectCompatProperty has to be analyzed carefully to comply with the rules given in \l {Writing to a Bindable Property}.
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 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 must be correctly updated.
Refer to \l {Bindable Properties with Virtual Setters and Getters} for more details.
In both cases the expected behavior 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.
Definition at line 508 of file qproperty_p.h.
using QObjectCompatProperty< Class, T, Offset, Setter, Signal, Getter >::arrow_operator_result = typename QPropertyData<T>::arrow_operator_result |
Definition at line 560 of file qproperty_p.h.
using QObjectCompatProperty< Class, T, Offset, Setter, Signal, Getter >::parameter_type = typename QPropertyData<T>::parameter_type |
Definition at line 559 of file qproperty_p.h.
using QObjectCompatProperty< Class, T, Offset, Setter, Signal, Getter >::value_type = typename QPropertyData<T>::value_type |
Definition at line 558 of file qproperty_p.h.
|
default |
|
inlineexplicit |
Definition at line 563 of file qproperty_p.h.
|
inlineexplicit |
Definition at line 564 of file qproperty_p.h.
|
inline |
Definition at line 717 of file qproperty_p.h.
|
inline |
Definition at line 690 of file qproperty_p.h.
References QBindingStorage::bindingData(), and qGetBindingStorage().
|
inline |
Definition at line 723 of file qproperty_p.h.
References qGetBindingStorage(), and storage.
|
inline |
Definition at line 643 of file qproperty_p.h.
References QtPrivate::QPropertyBindingData::binding(), QBindingStorage::bindingData(), and qGetBindingStorage().
|
inline |
Definition at line 658 of file qproperty_p.h.
References d, qGetBindingStorage(), and storage.
|
inline |
Definition at line 702 of file qproperty_p.h.
|
inline |
Definition at line 592 of file qproperty_p.h.
|
inline |
Definition at line 587 of file qproperty_p.h.
|
inline |
Definition at line 575 of file qproperty_p.h.
|
inline |
Definition at line 608 of file qproperty_p.h.
References setValue().
|
inline |
Definition at line 648 of file qproperty_p.h.
References qGetBindingStorage(), and storage.
|
inline |
Definition at line 614 of file qproperty_p.h.
References QBindingStorage::bindingData(), and qGetBindingStorage().
|
inline |
Definition at line 622 of file qproperty_p.h.
References QUntypedPropertyBinding::isNull(), and QUntypedPropertyBinding::valueMetaType().
|
inline |
Definition at line 632 of file qproperty_p.h.
References Qt::makePropertyBinding().
|
inline |
Definition at line 597 of file qproperty_p.h.
References qGetBindingStorage(), and storage.
|
inline |
Definition at line 709 of file qproperty_p.h.
|
inline |
Definition at line 696 of file qproperty_p.h.
|
inline |
Definition at line 566 of file qproperty_p.h.
References qGetBindingStorage(), and storage.
|
friend |
Definition at line 511 of file qproperty_p.h.