diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qproperty.cpp | 54 | ||||
-rw-r--r-- | src/corelib/kernel/qproperty.h | 26 | ||||
-rw-r--r-- | src/corelib/kernel/qproperty_p.h | 26 | ||||
-rw-r--r-- | src/corelib/kernel/qpropertyprivate.h | 22 |
4 files changed, 64 insertions, 64 deletions
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp index bd623bed18..17dd10e108 100644 --- a/src/corelib/kernel/qproperty.cpp +++ b/src/corelib/kernel/qproperty.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE using namespace QtPrivate; -void QPropertyBasePointer::addObserver(QPropertyObserver *observer) +void QPropertyBindingDataPointer::addObserver(QPropertyObserver *observer) { if (auto *binding = bindingPtr()) { observer->prev = &binding->firstObserver.ptr; @@ -55,7 +55,7 @@ void QPropertyBasePointer::addObserver(QPropertyObserver *observer) observer->next->prev = &observer->next; binding->firstObserver.ptr = observer; } else { - auto firstObserver = reinterpret_cast<QPropertyObserver*>(ptr->d_ptr & ~QPropertyBase::FlagMask); + auto firstObserver = reinterpret_cast<QPropertyObserver*>(ptr->d_ptr & ~QPropertyBindingData::FlagMask); observer->prev = reinterpret_cast<QPropertyObserver**>(&ptr->d_ptr); observer->next = firstObserver; if (observer->next) @@ -183,21 +183,21 @@ QMetaType QUntypedPropertyBinding::valueMetaType() const return d->valueMetaType(); } -QPropertyBase::QPropertyBase(QPropertyBase &&other, void *propertyDataPtr) +QPropertyBindingData::QPropertyBindingData(QPropertyBindingData &&other, void *propertyDataPtr) { std::swap(d_ptr, other.d_ptr); - QPropertyBasePointer d{this}; + QPropertyBindingDataPointer d{this}; d.setFirstObserver(nullptr); if (auto binding = d.bindingPtr()) binding->setProperty(propertyDataPtr); } -void QPropertyBase::moveAssign(QPropertyBase &&other, void *propertyDataPtr) +void QPropertyBindingData::moveAssign(QPropertyBindingData &&other, void *propertyDataPtr) { if (&other == this) return; - QPropertyBasePointer d{this}; + QPropertyBindingDataPointer d{this}; auto observer = d.firstObserver(); d.setFirstObserver(nullptr); @@ -216,9 +216,9 @@ void QPropertyBase::moveAssign(QPropertyBase &&other, void *propertyDataPtr) // The caller will have to notify observers. } -QPropertyBase::~QPropertyBase() +QPropertyBindingData::~QPropertyBindingData() { - QPropertyBasePointer d{this}; + QPropertyBindingDataPointer d{this}; for (auto observer = d.firstObserver(); observer;) { auto next = observer.nextObserver(); observer.unlink(); @@ -228,7 +228,7 @@ QPropertyBase::~QPropertyBase() binding->unlinkAndDeref(); } -QUntypedPropertyBinding QPropertyBase::setBinding(const QUntypedPropertyBinding &binding, +QUntypedPropertyBinding QPropertyBindingData::setBinding(const QUntypedPropertyBinding &binding, void *propertyDataPtr, void *staticObserver, QPropertyObserverCallback staticObserverCallback, @@ -237,7 +237,7 @@ QUntypedPropertyBinding QPropertyBase::setBinding(const QUntypedPropertyBinding QPropertyBindingPrivatePtr oldBinding; QPropertyBindingPrivatePtr newBinding = binding.d; - QPropertyBasePointer d{this}; + QPropertyBindingDataPointer d{this}; QPropertyObserverPointer observer; if (auto *existingBinding = d.bindingPtr()) { @@ -263,15 +263,15 @@ QUntypedPropertyBinding QPropertyBase::setBinding(const QUntypedPropertyBinding } else if (observer) { d.setObservers(observer.ptr); } else { - d_ptr &= ~QPropertyBase::BindingBit; + d_ptr &= ~QPropertyBindingData::BindingBit; } return QUntypedPropertyBinding(oldBinding.data()); } -QPropertyBindingPrivate *QPropertyBase::binding() const +QPropertyBindingPrivate *QPropertyBindingData::binding() const { - QPropertyBasePointer d{this}; + QPropertyBindingDataPointer d{this}; if (auto binding = d.bindingPtr()) return binding; return nullptr; @@ -300,18 +300,18 @@ QPropertyBindingPrivate *QPropertyBindingPrivate::currentlyEvaluatingBinding() return currentBindingEvaluationState ? currentBindingEvaluationState->binding : nullptr; } -void QPropertyBase::evaluateIfDirty() const +void QPropertyBindingData::evaluateIfDirty() const { - QPropertyBasePointer d{this}; + QPropertyBindingDataPointer d{this}; QPropertyBindingPrivate *binding = d.bindingPtr(); if (!binding) return; binding->evaluateIfDirtyAndReturnTrueIfValueChanged(); } -void QPropertyBase::removeBinding() +void QPropertyBindingData::removeBinding() { - QPropertyBasePointer d{this}; + QPropertyBindingDataPointer d{this}; if (auto *existingBinding = d.bindingPtr()) { auto observer = existingBinding->takeObservers(); @@ -322,27 +322,27 @@ void QPropertyBase::removeBinding() } } -void QPropertyBase::registerWithCurrentlyEvaluatingBinding() const +void QPropertyBindingData::registerWithCurrentlyEvaluatingBinding() const { auto currentState = currentBindingEvaluationState; if (!currentState) return; - QPropertyBasePointer d{this}; + QPropertyBindingDataPointer d{this}; QPropertyObserverPointer dependencyObserver = currentState->binding->allocateDependencyObserver(); dependencyObserver.setBindingToMarkDirty(currentState->binding); dependencyObserver.observeProperty(d); } -void QPropertyBase::notifyObservers(void *propertyDataPtr) const +void QPropertyBindingData::notifyObservers(void *propertyDataPtr) const { - QPropertyBasePointer d{this}; + QPropertyBindingDataPointer d{this}; if (QPropertyObserverPointer observer = d.firstObserver()) observer.notify(d.bindingPtr(), propertyDataPtr); } -int QPropertyBasePointer::observerCount() const +int QPropertyBindingDataPointer::observerCount() const { int count = 0; for (auto observer = firstObserver(); observer; observer = observer.nextObserver()) @@ -362,10 +362,10 @@ QPropertyObserver::QPropertyObserver(void *aliasedPropertyPtr) d.setAliasedProperty(aliasedPropertyPtr); } -void QPropertyObserver::setSource(const QPropertyBase &property) +void QPropertyObserver::setSource(const QPropertyBindingData &property) { QPropertyObserverPointer d{this}; - QPropertyBasePointer propPrivate{&property}; + QPropertyBindingDataPointer propPrivate{&property}; d.observeProperty(propPrivate); } @@ -471,7 +471,7 @@ void QPropertyObserverPointer::notify(QPropertyBindingPrivate *triggeringBinding } } -void QPropertyObserverPointer::observeProperty(QPropertyBasePointer property) +void QPropertyObserverPointer::observeProperty(QPropertyBindingDataPointer property) { if (ptr->prev) unlink(); @@ -795,7 +795,7 @@ QString QPropertyBindingError::description() const */ /*! - \fn template <typename T> QtPrivate::QPropertyBase &QProperty<T>::propertyBase() const + \fn template <typename T> QtPrivate::QPropertyBindingData &QProperty<T>::bindingData() const \internal */ @@ -1025,7 +1025,7 @@ QString QPropertyBindingError::description() const */ /*! - \fn template <typename T> QtPrivate::QPropertyBase &QNotifiedProperty<T, Callback>::propertyBase() const + \fn template <typename T> QtPrivate::QPropertyBindingData &QNotifiedProperty<T, Callback>::bindingData() const \internal */ diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index e120e834b2..ef738ccc5a 100644 --- a/src/corelib/kernel/qproperty.h +++ b/src/corelib/kernel/qproperty.h @@ -133,7 +133,7 @@ public: explicit QUntypedPropertyBinding(QPropertyBindingPrivate *priv); private: - friend class QtPrivate::QPropertyBase; + friend class QtPrivate::QPropertyBindingData; friend class QPropertyBindingPrivate; template <typename> friend class QPropertyBinding; QPropertyBindingPrivatePtr d; @@ -167,9 +167,9 @@ public: : QUntypedPropertyBinding(QMetaType::fromType<PropertyType>(), BindingAdaptor<Functor>{std::forward<Functor>(f)}, location) {} - template<typename Property, typename = std::void_t<decltype(&Property::propertyBase)>> + template<typename Property, typename = std::void_t<decltype(&Property::bindingData)>> QPropertyBinding(const Property &property) - : QUntypedPropertyBinding(property.propertyBase().binding()) + : QUntypedPropertyBinding(property.bindingData().binding()) {} // Internal @@ -187,13 +187,13 @@ namespace Qt { } } -struct QPropertyBasePointer; +struct QPropertyBindingDataPointer; template <typename T> class QProperty { T val = T(); - QtPrivate::QPropertyBase d; + QtPrivate::QPropertyBindingData d; bool is_equal(const T &v) { if constexpr (QTypeTraits::has_operator_equal_v<T>) { @@ -346,7 +346,7 @@ public: template<typename Functor> QPropertyChangeHandler<Functor> subscribe(Functor f); - const QtPrivate::QPropertyBase &propertyBase() const { return d; } + const QtPrivate::QPropertyBindingData &bindingData() const { return d; } private: void notify() { @@ -370,7 +370,7 @@ template <typename T, auto Callback, auto ValueGuard=nullptr> class QNotifiedProperty { T val = T(); - QtPrivate::QPropertyBase d; + QtPrivate::QPropertyBindingData d; bool is_equal(const T &v) { if constexpr (QTypeTraits::has_operator_equal_v<T>) { @@ -532,7 +532,7 @@ public: template<typename Functor> QPropertyChangeHandler<Functor> subscribe(Functor f); - const QtPrivate::QPropertyBase &propertyBase() const { return d; } + const QtPrivate::QPropertyBindingData &bindingData() const { return d; } private: void notify(Class *owner, T *oldValue=nullptr) { @@ -566,9 +566,9 @@ public: QPropertyObserver &operator=(QPropertyObserver &&other); ~QPropertyObserver(); - template<typename Property, typename = std::enable_if_t<std::is_same_v<decltype(std::declval<Property>().propertyBase()), QtPrivate::QPropertyBase &>>> + template<typename Property, typename = std::enable_if_t<std::is_same_v<decltype(std::declval<Property>().bindingData()), QtPrivate::QPropertyBindingData &>>> void setSource(const Property &property) - { setSource(property.propertyBase()); } + { setSource(property.bindingData()); } protected: QPropertyObserver(void (*callback)(QPropertyObserver*, void *)); @@ -581,7 +581,7 @@ protected: } private: - void setSource(const QtPrivate::QPropertyBase &property); + void setSource(const QtPrivate::QPropertyBindingData &property); QTaggedPointer<QPropertyObserver, ObserverTag> next; // prev is a pointer to the "next" element within the previous node, or to the "firstObserverPtr" if it is the @@ -598,7 +598,7 @@ private: QPropertyObserver &operator=(const QPropertyObserver &) = delete; friend struct QPropertyObserverPointer; - friend struct QPropertyBasePointer; + friend struct QPropertyBindingDataPointer; friend class QPropertyBindingPrivate; }; @@ -616,7 +616,7 @@ public: { } - template<typename Property, typename = std::void_t<decltype(&Property::propertyBase)>> + template<typename Property, typename = std::void_t<decltype(&Property::bindingData)>> QPropertyChangeHandler(const Property &property, Functor handler) : QPropertyObserver([](QPropertyObserver *self, void *) { auto This = static_cast<QPropertyChangeHandler<Functor>*>(self); diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h index 4cb55f8b47..6e8f4b4516 100644 --- a/src/corelib/kernel/qproperty_p.h +++ b/src/corelib/kernel/qproperty_p.h @@ -65,21 +65,21 @@ QT_BEGIN_NAMESPACE // we need to allow the compiler to inline where it makes sense. // This is a helper "namespace" -struct Q_AUTOTEST_EXPORT QPropertyBasePointer +struct Q_AUTOTEST_EXPORT QPropertyBindingDataPointer { - const QtPrivate::QPropertyBase *ptr = nullptr; + const QtPrivate::QPropertyBindingData *ptr = nullptr; QPropertyBindingPrivate *bindingPtr() const { - if (ptr->d_ptr & QtPrivate::QPropertyBase::BindingBit) - return reinterpret_cast<QPropertyBindingPrivate*>(ptr->d_ptr & ~QtPrivate::QPropertyBase::FlagMask); + if (ptr->d_ptr & QtPrivate::QPropertyBindingData::BindingBit) + return reinterpret_cast<QPropertyBindingPrivate*>(ptr->d_ptr & ~QtPrivate::QPropertyBindingData::FlagMask); return nullptr; } void setObservers(QPropertyObserver *observer) { observer->prev = reinterpret_cast<QPropertyObserver**>(&(ptr->d_ptr)); - ptr->d_ptr = (reinterpret_cast<quintptr>(observer) & ~QtPrivate::QPropertyBase::FlagMask); + ptr->d_ptr = (reinterpret_cast<quintptr>(observer) & ~QtPrivate::QPropertyBindingData::FlagMask); } void addObserver(QPropertyObserver *observer); void setFirstObserver(QPropertyObserver *observer); @@ -88,9 +88,9 @@ struct Q_AUTOTEST_EXPORT QPropertyBasePointer int observerCount() const; template <typename T> - static QPropertyBasePointer get(QProperty<T> &property) + static QPropertyBindingDataPointer get(QProperty<T> &property) { - return QPropertyBasePointer{&property.propertyBase()}; + return QPropertyBindingDataPointer{&property.bindingData()}; } }; @@ -106,7 +106,7 @@ struct QPropertyObserverPointer void setAliasedProperty(void *propertyPtr); void notify(QPropertyBindingPrivate *triggeringBinding, void *propertyDataPtr); - void observeProperty(QPropertyBasePointer property); + void observeProperty(QPropertyBindingDataPointer property); explicit operator bool() const { return ptr != nullptr; } @@ -132,7 +132,7 @@ struct BindingEvaluationState class Q_CORE_EXPORT QPropertyBindingPrivate : public QSharedData { private: - friend struct QPropertyBasePointer; + friend struct QPropertyBindingDataPointer; using ObserverArray = std::array<QPropertyObserver, 4>; @@ -255,20 +255,20 @@ public: static QPropertyBindingPrivate *currentlyEvaluatingBinding(); }; -inline void QPropertyBasePointer::setFirstObserver(QPropertyObserver *observer) +inline void QPropertyBindingDataPointer::setFirstObserver(QPropertyObserver *observer) { if (auto *binding = bindingPtr()) { binding->firstObserver.ptr = observer; return; } - ptr->d_ptr = reinterpret_cast<quintptr>(observer) | (ptr->d_ptr & QtPrivate::QPropertyBase::FlagMask); + ptr->d_ptr = reinterpret_cast<quintptr>(observer) | (ptr->d_ptr & QtPrivate::QPropertyBindingData::FlagMask); } -inline QPropertyObserverPointer QPropertyBasePointer::firstObserver() const +inline QPropertyObserverPointer QPropertyBindingDataPointer::firstObserver() const { if (auto *binding = bindingPtr()) return binding->firstObserver; - return {reinterpret_cast<QPropertyObserver*>(ptr->d_ptr & ~QtPrivate::QPropertyBase::FlagMask)}; + return {reinterpret_cast<QPropertyObserver*>(ptr->d_ptr & ~QtPrivate::QPropertyBindingData::FlagMask)}; } QT_END_NAMESPACE diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h index acdf405648..bab4162472 100644 --- a/src/corelib/kernel/qpropertyprivate.h +++ b/src/corelib/kernel/qpropertyprivate.h @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE class QUntypedPropertyBinding; class QPropertyBindingPrivate; using QPropertyBindingPrivatePtr = QExplicitlySharedDataPointer<QPropertyBindingPrivate>; -struct QPropertyBasePointer; +struct QPropertyBindingDataPointer; namespace QtPrivate { @@ -74,21 +74,21 @@ using QPropertyGuardFunction = bool(*)(QMetaType, void *dataPtr, QPropertyBindingFunction, void *owner); using QPropertyObserverCallback = void (*)(void *, void *); -class Q_CORE_EXPORT QPropertyBase +class Q_CORE_EXPORT QPropertyBindingData { // Mutable because the address of the observer of the currently evaluating binding is stored here, for // notification later when the value changes. mutable quintptr d_ptr = 0; - friend struct QT_PREPEND_NAMESPACE(QPropertyBasePointer); + friend struct QT_PREPEND_NAMESPACE(QPropertyBindingDataPointer); public: - QPropertyBase() = default; - Q_DISABLE_COPY(QPropertyBase) - QPropertyBase(QPropertyBase &&other) = delete; - QPropertyBase(QPropertyBase &&other, void *propertyDataPtr); - QPropertyBase &operator=(QPropertyBase &&other) = delete; - ~QPropertyBase(); - - void moveAssign(QPropertyBase &&other, void *propertyDataPtr); + QPropertyBindingData() = default; + Q_DISABLE_COPY(QPropertyBindingData) + QPropertyBindingData(QPropertyBindingData &&other) = delete; + QPropertyBindingData(QPropertyBindingData &&other, void *propertyDataPtr); + QPropertyBindingData &operator=(QPropertyBindingData &&other) = delete; + ~QPropertyBindingData(); + + void moveAssign(QPropertyBindingData &&other, void *propertyDataPtr); bool hasBinding() const { return d_ptr & BindingBit; } |