From 43e3c21a0bad9141b6c35cc4ee4a58b4d824462a Mon Sep 17 00:00:00 2001 From: Pierre-Yves Siret Date: Fri, 20 Dec 2019 01:51:39 +0100 Subject: Add Q_GADGET Wrapper for QQmlProperty This enable exposing a QQmlProperty as a value type to QML code. Only object and name are exposed as a properties to keep it simple. We might want later to expose the property of a Binding or a Behavior as a property for complex usecases. This permits exposing it as one self contained value instead of a pair of unrelated object and name. Task-number: QTBUG-70964 Task-number: QTBUG-73892 Change-Id: I3a46212446f43f3a7e301943cb49d3a48c377de3 Reviewed-by: Ulf Hermann --- src/qml/qml/qqmlvaluetype_p.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/qml/qml/qqmlvaluetype_p.h') diff --git a/src/qml/qml/qqmlvaluetype_p.h b/src/qml/qml/qqmlvaluetype_p.h index 9c008859da..0d581c7be8 100644 --- a/src/qml/qml/qqmlvaluetype_p.h +++ b/src/qml/qml/qqmlvaluetype_p.h @@ -264,6 +264,17 @@ public: QVariantList bezierCurve() const; }; +struct QQmlPropertyValueType +{ + QQmlProperty v; + Q_PROPERTY(QObject *object READ object CONSTANT FINAL) + Q_PROPERTY(QString name READ name CONSTANT FINAL) + Q_GADGET +public: + QObject *object() const; + QString name() const; +}; + template int qmlRegisterValueTypeEnums(const char *uri, int versionMajor, int versionMinor, const char *qmlName) { -- cgit v1.2.3