diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-08-25 12:27:56 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-09-02 22:44:28 +0200 |
commit | 3b3b190eef036ffefb5275e6f03e9f933d3609ff (patch) | |
tree | 6c1f58ff6e0f2dab418d5b9bb11423d78ad32789 /src/corelib/kernel/qpropertyprivate.h | |
parent | af149ada60b7fd8a51ebae97b1324e06c919f2e9 (diff) |
Add support for bindable properties to QObject
Add Q_OBJECT_BINDABLE_PROPERTY() macro that can be used to define
a bindable property inside QObject.
The macro and the class behind it creates storage for a property
that is bindable inside a QObject or QObjectPrivate. The property
only uses as much space as the data contained, ie. it has no
storage overhead, as long as no bindings are being used.
Bindings are being stored and looked up in the QBindingStorage
associated with the owning object.
Change-Id: I1dadd7bddbad6fbf10cfa791d6461574b9db82dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/kernel/qpropertyprivate.h')
-rw-r--r-- | src/corelib/kernel/qpropertyprivate.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h index adc347db84..6f0e563a28 100644 --- a/src/corelib/kernel/qpropertyprivate.h +++ b/src/corelib/kernel/qpropertyprivate.h @@ -178,6 +178,15 @@ namespace detail { template<typename T, typename C> struct ExtractClassFromFunctionPointer<T C::*> { using Class = C; }; + + constexpr size_t getOffset(size_t o) + { + return o; + } + constexpr size_t getOffset(size_t (*offsetFn)()) + { + return offsetFn(); + } } // type erased guard functions, casts its arguments to the correct types |