summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-08-25 12:27:09 +0200
committerLars Knoll <lars.knoll@qt.io>2020-09-02 22:44:28 +0200
commit6778b247a8c20adfb3f4e3094077baae43f3e65c (patch)
tree61da119dc749554c6b09b79f0b39ac6c8d4e8306 /src/corelib/kernel/qobject.h
parent9b6df7deb3fff6179071ee59603250cb59c03222 (diff)
Add a QBindingStorage class
QBindingStorage is a class that can store a set of binding objects for the properties of a QObject. This will get used to reduce the memory overhead of the property system when adding bindable properties to QObject based classes. The binding storage has a pointer to the TLS entry containing the currently evaluating binding. Like that we avoid repeated TLS lookups and reduce the overhead of the property system to one pointer lookup and one compare for the case that properties aren't being used. Each QObject now owns one binding storage object, that can be used to store binding data for properties that members of the QObject. Change-Id: I27427c03c2ba281f072e074be96147bdbcaac246 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qobject.h')
-rw-r--r--src/corelib/kernel/qobject.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index d1a0c3562c..21081fa569 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -62,6 +62,7 @@
QT_BEGIN_NAMESPACE
+class QBindingStorage;
class QEvent;
class QTimerEvent;
class QChildEvent;
@@ -371,6 +372,8 @@ public:
bool setProperty(const char *name, const QVariant &value);
QVariant property(const char *name) const;
QList<QByteArray> dynamicPropertyNames() const;
+ QBindingStorage *bindingStorage();
+ const QBindingStorage *bindingStorage() const;
#endif // QT_NO_PROPERTIES
Q_SIGNALS:
@@ -457,6 +460,14 @@ inline T qobject_cast(const QObject *object)
template <class T> inline const char * qobject_interface_iid()
{ return nullptr; }
+inline const QBindingStorage *qGetBindingStorage(const QObject *o)
+{
+ return o->bindingStorage();
+}
+inline QBindingStorage *qGetBindingStorage(QObject *o)
+{
+ return o->bindingStorage();
+}
#if defined(Q_CLANG_QDOC)
# define Q_DECLARE_INTERFACE(IFace, IId)