summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qpropertybinding_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-07-08 12:07:13 +0200
committerLars Knoll <lars.knoll@qt.io>2020-07-10 15:07:12 +0200
commitbbfecdee1e2952c401e9c5ac6e16adc2428fb2dc (patch)
tree4b877d63b50606930bbac7416b3d164ae69cb70a /src/corelib/kernel/qpropertybinding_p.h
parentbe1ce6b26909256e62c2b39e4de9f8f79d070937 (diff)
Significantly improve performance of binding evaluation
Avoid any QVariant or type dependent code in the cpp files. Instead, let the binding wrapper determine if the value has changed and return true/false accordingly. This required also some reworking of the guard mechanism for notified properties, where the guard function wrapper now calls first the binding evaluation function and then passes the result to the guard. Change-Id: I350d07a508ccc0c5db7054a0efa4f270b6a78ec3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qpropertybinding_p.h')
-rw-r--r--src/corelib/kernel/qpropertybinding_p.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/kernel/qpropertybinding_p.h b/src/corelib/kernel/qpropertybinding_p.h
index 7722a4b7c5..9a18ff9015 100644
--- a/src/corelib/kernel/qpropertybinding_p.h
+++ b/src/corelib/kernel/qpropertybinding_p.h
@@ -80,8 +80,8 @@ private:
ObserverArray inlineDependencyObservers;
struct {
void *staticObserver;
- void (*staticObserverCallback)(void*, void*);
- bool (*staticGuardCallback)(void*, void*);
+ QtPrivate::QPropertyObserverCallback staticObserverCallback;
+ QtPrivate::QPropertyGuardFunction staticGuardCallback;
};
};
QScopedPointer<std::vector<QPropertyObserver>> heapObservers;
@@ -108,7 +108,8 @@ public:
void setDirty(bool d) { dirty = d; }
void setProperty(void *propertyPtr) { propertyDataPtr = propertyPtr; }
- void setStaticObserver(void *observer, void (*callback)(void*, void*), bool (*guardCallback)(void *, void*))
+ void setStaticObserver(void *observer, QtPrivate::QPropertyObserverCallback callback,
+ QtPrivate::QPropertyGuardFunction guardCallback)
{
if (observer) {
if (!hasStaticObserver) {