summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qpropertyprivate.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-08-21 17:52:22 +0200
committerLars Knoll <lars.knoll@qt.io>2020-09-02 22:44:28 +0200
commitb788c64dc3a5e40ac410b9bd2c79f6f2d0963737 (patch)
treee1c0996448bfbd38242d3a53ff133e0fdd93a81c /src/corelib/kernel/qpropertyprivate.h
parent6778b247a8c20adfb3f4e3094077baae43f3e65c (diff)
Cleanup QBindingPrivate
Simplify the data structure. We only need one pointer for either the static callback or a bindingWrapper, so don't share it with the dependency observer array. Also ensure we reset the propertyDataPtr and clear the observers when the binding gets removed from a property. Change-Id: I4c1e7ec7823c3ef12c63d6f758b757e7bac60cae Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qpropertyprivate.h')
-rw-r--r--src/corelib/kernel/qpropertyprivate.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h
index 33ecb405f2..adc347db84 100644
--- a/src/corelib/kernel/qpropertyprivate.h
+++ b/src/corelib/kernel/qpropertyprivate.h
@@ -77,7 +77,7 @@ namespace QtPrivate {
// writes binding result into dataPtr
using QPropertyBindingFunction = std::function<bool(QMetaType metaType, QUntypedPropertyData *dataPtr)>;
-using QPropertyGuardFunction = bool(*)(QMetaType, QUntypedPropertyData *dataPtr,
+using QPropertyBindingWrapper = bool(*)(QMetaType, QUntypedPropertyData *dataPtr,
QPropertyBindingFunction);
using QPropertyObserverCallback = void (*)(QUntypedPropertyData *);
@@ -102,7 +102,7 @@ public:
QUntypedPropertyBinding setBinding(const QUntypedPropertyBinding &newBinding,
QUntypedPropertyData *propertyDataPtr,
QPropertyObserverCallback staticObserverCallback = nullptr,
- QPropertyGuardFunction guardCallback = nullptr);
+ QPropertyBindingWrapper guardCallback = nullptr);
QPropertyBindingPrivate *binding() const;
void evaluateIfDirty() const;
@@ -184,7 +184,7 @@ namespace detail {
template<typename T, typename Class, auto Guard, bool = std::is_same_v<decltype(Guard), std::nullptr_t>>
struct QPropertyGuardFunctionHelper
{
- static constexpr QPropertyGuardFunction guard = nullptr;
+ static constexpr QPropertyBindingWrapper guard = nullptr;
};
template<typename T, typename Class, auto Guard>
struct QPropertyGuardFunctionHelper<T, Class, Guard, false>