diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2020-03-04 14:54:54 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2020-04-03 12:35:23 +0200 |
commit | 448b2a5d838d082c66ab649cc7b71c31761bf409 (patch) | |
tree | 17888b90b9e03eb52e2ba03611146a66a87e31a1 /src/qml/qml/qqmlabstractbinding_p.h | |
parent | f1fd2b982a2ceae92da9b4a3875c65ed8a49560d (diff) |
Replace QFlagPointer with QTaggedPointer
The latter has the advantage of allowing the use of a real type for the
tag, instead of the generic flag/flag2 boolean accessors.
Change-Id: Icc9e854ce4af3eb5808a4bed45aa22f377e223da
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlabstractbinding_p.h')
-rw-r--r-- | src/qml/qml/qqmlabstractbinding_p.h | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/qml/qml/qqmlabstractbinding_p.h b/src/qml/qml/qqmlabstractbinding_p.h index fc53be3e7b..96bb0da269 100644 --- a/src/qml/qml/qqmlabstractbinding_p.h +++ b/src/qml/qml/qqmlabstractbinding_p.h @@ -92,7 +92,7 @@ public: inline QQmlAbstractBinding *nextBinding() const; inline bool canUseAccessor() const - { return m_nextBinding.flag2(); } + { return m_nextBinding.tag().testFlag(CanUseAccessor); } struct RefCount { RefCount() {} @@ -103,6 +103,20 @@ public: }; RefCount ref; + enum TargetTag { + NoTargetTag = 0x0, + UpdatingBinding = 0x1, + BindingEnabled = 0x2 + }; + Q_DECLARE_FLAGS(TargetTags, TargetTag) + + enum NextBindingTag { + NoBindingTag = 0x0, + AddedToObject = 0x1, + CanUseAccessor = 0x2 + }; + Q_DECLARE_FLAGS(NextBindingTags, NextBindingTag) + protected: friend class QQmlData; friend class QQmlValueTypeProxyBinding; @@ -116,24 +130,23 @@ protected: QQmlPropertyIndex m_targetIndex; // Pointer is the target object to which the binding binds - // flag1 is the updating flag - // flag2 is the enabled flag - QFlagPointer<QObject> m_target; + QTaggedPointer<QObject, TargetTags> m_target; // Pointer to the next binding in the linked list of bindings. - // flag1 is used for addedToObject - // flag2 indicates if an accessor is can be used (i.e. there is no interceptor on the target) - QFlagPointer<QQmlAbstractBinding> m_nextBinding; + QTaggedPointer<QQmlAbstractBinding, NextBindingTags> m_nextBinding; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlAbstractBinding::TargetTags) +Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlAbstractBinding::NextBindingTags) + void QQmlAbstractBinding::setAddedToObject(bool v) { - m_nextBinding.setFlagValue(v); + m_nextBinding.setTag(m_nextBinding.tag().setFlag(AddedToObject, v)); } bool QQmlAbstractBinding::isAddedToObject() const { - return m_nextBinding.flag(); + return m_nextBinding.tag().testFlag(AddedToObject); } QQmlAbstractBinding *QQmlAbstractBinding::nextBinding() const |