From 1e0be201c3a48e9cc6fe503b2f1a695bd3846072 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Wed, 28 Apr 2021 15:36:18 +0200 Subject: [PATCH] QUntypedBindable: Allow controlled access to internals In declarative, we need direct access to the bindable's pointers. Enable this via a internal only helper struct in qproperty_p.h. Change-Id: I56e4622f570ff08f85f1161af608658ea510671e Reviewed-by: Maximilian Goldstein Reviewed-by: Andrei Golubev Reviewed-by: Ulf Hermann --- src/corelib/kernel/qproperty.h | 1 + src/corelib/kernel/qproperty_p.h | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index 7924049698..1faf87aadc 100644 --- a/src/corelib/kernel/qproperty.h +++ b/src/corelib/kernel/qproperty.h @@ -566,6 +566,7 @@ Q_CORE_EXPORT void printMetaTypeMismatch(QMetaType actual, QMetaType expected); class QUntypedBindable { + friend struct QUntypedBindablePrivate; // allows access to internal data protected: QUntypedPropertyData *data = nullptr; const QtPrivate::QBindableInterface *iface = nullptr; diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h index 6a074efebb..b2bba3d6f4 100644 --- a/src/corelib/kernel/qproperty_p.h +++ b/src/corelib/kernel/qproperty_p.h @@ -629,6 +629,19 @@ Q_CORE_EXPORT BindingEvaluationState *suspendCurrentBindingStatus(); Q_CORE_EXPORT void restoreBindingStatus(BindingEvaluationState *status); } +struct QUntypedBindablePrivate +{ + static QtPrivate::QBindableInterface const *getInterface(const QUntypedBindable &bindable) + { + return bindable.iface; + } + + static QUntypedPropertyData *getPropertyData(const QUntypedBindable &bindable) + { + return bindable.data; + } +}; + QT_END_NAMESPACE #endif // QPROPERTY_P_H