From f3ce9e9332820a8b5084fb4d75994e8eb19ddfd3 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 23 Mar 2020 21:30:21 +0100 Subject: Make QPropertyBindingPrivate accessible to QtQml QtQml needs the private just for one detail which nobody else should need it for: Tracking additional dependencies and marking the binding as dirty. Exporting the private requires hiding some variables and providing accessors, to compile with MSVC - including the removal of QVarLengthArray usage. Upside: The binding structure shrinks by 8 bytes and the encapsulation makes it a little easier to change things without breaking declarative, ... in the unlikely event ;-) Also remove setDirty() from the public API as it's not needed by QtQml and using it is dangerous, because it means that there's a risk of somebody keeping a reference (count) to the untyped binding from within the binding closure, which introduces a memory leak. Change-Id: I43bd56f4bdf218efb54fa23e2d627ad3acfafeb5 Reviewed-by: Fabian Kosmale --- src/corelib/kernel/qproperty.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/corelib/kernel/qproperty.h') diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index 21b2ed0839..338c7bbeec 100644 --- a/src/corelib/kernel/qproperty.h +++ b/src/corelib/kernel/qproperty.h @@ -137,12 +137,10 @@ public: QMetaType valueMetaType() const; - void setDirty(bool dirty = true); - -private: explicit QUntypedPropertyBinding(const QPropertyBindingPrivatePtr &priv); +private: friend class QtPrivate::QPropertyBase; - friend struct QPropertyBindingPrivate; + friend class QPropertyBindingPrivate; template friend class QPropertyBinding; QPropertyBindingPrivatePtr d; }; @@ -357,7 +355,7 @@ private: friend struct QPropertyBasePointer; friend class QPropertyBinding; - friend struct QPropertyObserver; + friend class QPropertyObserver; // Mutable because querying for the value may require evalating the binding expression, calling // non-const functions on QPropertyBase. mutable QtPrivate::QPropertyValueStorage d; @@ -385,8 +383,9 @@ namespace Qt { struct QPropertyObserverPrivate; struct QPropertyObserverPointer; -struct Q_CORE_EXPORT QPropertyObserver +class Q_CORE_EXPORT QPropertyObserver { +public: // Internal enum ObserverTag { ObserverNotifiesBinding = 0x0, @@ -394,7 +393,7 @@ struct Q_CORE_EXPORT QPropertyObserver }; Q_DECLARE_FLAGS(ObserverTags, ObserverTag) - QPropertyObserver() = default; + QPropertyObserver(); QPropertyObserver(QPropertyObserver &&other); QPropertyObserver &operator=(QPropertyObserver &&other); ~QPropertyObserver(); @@ -424,6 +423,7 @@ private: friend struct QPropertyObserverPointer; friend struct QPropertyBasePointer; + friend class QPropertyBindingPrivate; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QPropertyObserver::ObserverTags) -- cgit v1.2.3