diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-02-06 22:22:56 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-02-15 20:39:09 +0100 |
commit | 99db1d54ed7f309ef33e8254e5d0af4fa68a219a (patch) | |
tree | 638747cb296218258a55314724c513307e4608aa /src | |
parent | 4d579851c842e136fbaf7a5d629c249456a91e39 (diff) |
QPropertyBindingPrivate: Support QQmlProperyBinding
QQmlProperyBinding needs the ability to suspend binding evaluation, and
needs access to the propertyDataPtr.
Change-Id: If82079ffdf28fb277c6e5083714c28478f6e1729
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qproperty.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qproperty_p.h | 8 | ||||
-rw-r--r-- | src/corelib/kernel/qpropertyprivate.h | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp index b017bb3230..342133c991 100644 --- a/src/corelib/kernel/qproperty.cpp +++ b/src/corelib/kernel/qproperty.cpp @@ -1697,6 +1697,7 @@ QPropertyBindingData *QBindingStorage::bindingData_helper(QUntypedPropertyData * } +namespace QtPrivate { BindingEvaluationState *suspendCurrentBindingStatus() { auto ret = bindingStatus.currentlyEvaluatingBinding; @@ -1709,7 +1710,6 @@ void restoreBindingStatus(BindingEvaluationState *status) bindingStatus.currentlyEvaluatingBinding = status; } -namespace QtPrivate { /*! \internal This function can be used to detect whether we are currently diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h index fe15b91438..015e9ea141 100644 --- a/src/corelib/kernel/qproperty_p.h +++ b/src/corelib/kernel/qproperty_p.h @@ -193,6 +193,7 @@ private: QPropertyObserverPointer firstObserver; // list of observers observing us QScopedPointer<std::vector<QPropertyObserver>> heapObservers; // for things we are observing +protected: QUntypedPropertyData *propertyDataPtr = nullptr; /* For bindings set up from C++, location stores where the binding was created in the C++ source @@ -203,7 +204,6 @@ private: */ static_assert(std::is_trivially_destructible_v<QPropertyBindingSourceLocation>); static_assert(std::is_trivially_destructible_v<std::byte[sizeof(QPropertyBindingSourceLocation)]>); -protected: using DeclarativeErrorCallback = void(*)(QPropertyBindingPrivate *); union { QPropertyBindingSourceLocation location; @@ -353,6 +353,7 @@ public: delete[] reinterpret_cast<std::byte *>(priv); } } + private: bool evaluateIfDirtyAndReturnTrueIfValueChanged_helper(const QUntypedPropertyData *data, QBindingStatus *status = nullptr); }; @@ -584,6 +585,11 @@ private: QObjectCompatProperty<Class, Type, Class::_qt_property_##name##_offset, setter>( \ value); +namespace QtPrivate { +Q_CORE_EXPORT BindingEvaluationState *suspendCurrentBindingStatus(); +Q_CORE_EXPORT void restoreBindingStatus(BindingEvaluationState *status); +} + QT_END_NAMESPACE #endif // QPROPERTY_P_H diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h index c53e15c2ec..474e911995 100644 --- a/src/corelib/kernel/qpropertyprivate.h +++ b/src/corelib/kernel/qpropertyprivate.h @@ -69,6 +69,7 @@ struct RefCounted { }; } +class QQmlPropertyBinding; class QPropertyBindingPrivate; class QPropertyBindingPrivatePtr { @@ -223,6 +224,7 @@ class Q_CORE_EXPORT QPropertyBindingData // notification later when the value changes. mutable quintptr d_ptr = 0; friend struct QT_PREPEND_NAMESPACE(QPropertyBindingDataPointer); + friend class QT_PREPEND_NAMESPACE(QQmlPropertyBinding); Q_DISABLE_COPY(QPropertyBindingData) public: QPropertyBindingData() = default; |