aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqml.cpp
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2022-05-09 17:35:35 +0200
committerAndrei Golubev <andrei.golubev@qt.io>2022-05-12 17:36:12 +0200
commit5cd59bff0c2f077ab47c40710a5267c06d3d2aa9 (patch)
treeb3a1f34ce103f1834f20f5921c33f02ad646cff4 /src/qml/qml/qqml.cpp
parentc8f9cb050df690696422df2f79f1124340037547 (diff)
Support querying indirect extensions for a given object
Introduce a private version of qmlExtendedObject() that returns an index-based extension (where 0 represents an extension on the leaf type and N represents a (N - 1)th base type's extension) Teach QQmlProxyMetaObject to distinguish different extension proxies. Its custom metaCall can now query up to 128 extensions (should be enough for the user needs) Change-Id: I5520a1e84501f1f9fe6a8e77d8269009a12c255c Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqml.cpp')
-rw-r--r--src/qml/qml/qqml.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp
index 728250dcf2..3c9f930eb9 100644
--- a/src/qml/qml/qqml.cpp
+++ b/src/qml/qml/qqml.cpp
@@ -151,6 +151,11 @@ QObject *qmlAttachedPropertiesObject(QObject *object, QQmlAttachedPropertiesFunc
QObject *qmlExtendedObject(QObject *object)
{
+ return QQmlPrivate::qmlExtendedObject(object, 0);
+}
+
+QObject *QQmlPrivate::qmlExtendedObject(QObject *object, int index)
+{
if (!object)
return nullptr;
@@ -161,8 +166,8 @@ QObject *qmlExtendedObject(QObject *object)
const int id = d->metaObject->metaCall(
object, QMetaObject::CustomCall,
- QQmlProxyMetaObject::ExtensionObjectId, &result);
- if (id != QQmlProxyMetaObject::ExtensionObjectId)
+ QQmlProxyMetaObject::extensionObjectId(index), &result);
+ if (id != QQmlProxyMetaObject::extensionObjectId(index))
return nullptr;
return static_cast<QObject *>(result);