aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml')
-rw-r--r--src/qml/qml/qqmlmetatype.cpp16
-rw-r--r--src/qml/qml/qqmlmetatype_p.h2
-rw-r--r--src/qml/qml/qqmltype.cpp1
3 files changed, 16 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index db4ecc6397..110363ae3b 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -1430,6 +1430,14 @@ void QQmlMetaType::unregisterType(int typeIndex)
}
}
+void QQmlMetaType::registerMetaObjectForType(const QMetaObject *metaobject, QQmlTypePrivate *type)
+{
+ Q_ASSERT(type);
+
+ QQmlMetaTypeDataPtr data;
+ data->metaObjectToType.insert(metaobject, type);
+}
+
static bool hasActiveInlineComponents(const QQmlTypePrivate *d)
{
for (const QQmlType &ic : qAsConst(d->objectIdToICType)) {
@@ -1635,7 +1643,8 @@ QList<QQmlProxyMetaObject::ProxyData> QQmlMetaType::proxyData(const QMetaObject
const QQmlMetaTypeDataPtr data;
- auto createProxyMetaObject = [&](const QMetaObject *superdataBaseMetaObject,
+ auto createProxyMetaObject = [&](QQmlTypePrivate *This,
+ const QMetaObject *superdataBaseMetaObject,
const QMetaObject *extMetaObject,
QObject *(*extFunc)(QObject *)) {
if (!extMetaObject)
@@ -1652,16 +1661,17 @@ QList<QQmlProxyMetaObject::ProxyData> QQmlMetaType::proxyData(const QMetaObject
lastMetaObject->d.superdata = mmo;
QQmlProxyMetaObject::ProxyData data = { mmo, extFunc, 0, 0 };
metaObjects << data;
+ registerMetaObjectForType(mmo, This);
};
while (mo) {
QQmlTypePrivate *t = data->metaObjectToType.value(mo);
if (t) {
if (t->regType == QQmlType::CppType) {
- createProxyMetaObject(t->baseMetaObject, t->extraData.cd->extMetaObject,
+ createProxyMetaObject(t, t->baseMetaObject, t->extraData.cd->extMetaObject,
t->extraData.cd->extFunc);
} else if (t->regType == QQmlType::SingletonType) {
- createProxyMetaObject(t->baseMetaObject, t->extraData.sd->extMetaObject,
+ createProxyMetaObject(t, t->baseMetaObject, t->extraData.sd->extMetaObject,
t->extraData.sd->extFunc);
}
}
diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h
index 2c010f516d..b9bf78b0a7 100644
--- a/src/qml/qml/qqmlmetatype_p.h
+++ b/src/qml/qml/qqmlmetatype_p.h
@@ -148,6 +148,8 @@ public:
static void unregisterType(int type);
+ static void registerMetaObjectForType(const QMetaObject *metaobject, QQmlTypePrivate *type);
+
static void registerModule(const char *uri, QTypeRevision version);
static bool protectModule(const QString &uri, QTypeRevision version,
bool weakProtectAllVersions = false);
diff --git a/src/qml/qml/qqmltype.cpp b/src/qml/qml/qqmltype.cpp
index 1d34b57fed..0bc817845d 100644
--- a/src/qml/qml/qqmltype.cpp
+++ b/src/qml/qml/qqmltype.cpp
@@ -232,6 +232,7 @@ void QQmlTypePrivate::init() const
mmo->d.superdata = mo;
QQmlProxyMetaObject::ProxyData data = { mmo, extFunc, 0, 0 };
metaObjects << data;
+ QQmlMetaType::registerMetaObjectForType(mmo, const_cast<QQmlTypePrivate *>(this));
};
if (regType == QQmlType::SingletonType)