aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlmetatype.cpp
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2022-05-18 14:37:01 +0200
committerAndrei Golubev <andrei.golubev@qt.io>2022-05-24 10:30:44 +0200
commitc02dd17a4f648ec18c6ff2ae7bfe468bd9c42732 (patch)
tree2975f030e9cbbcffa3ecb79d835507e86298ef8b /src/qml/qml/qqmlmetatype.cpp
parentce441f819389d729dea63a7d1ae02fae35b35bfc (diff)
Support extension property revisions
Previously the extension's property revision would make the property unusable since extensions would've been skipped from property cache construction w.r.t. revisions This is due to the meta object cloning that we do for extension types (since we put the cloned meta object on top of the meta object hierarchy for the QQmlProxyMetaObject). Once cloned, the meta object has no associated QQmlType anymore and we need one to deal with revisions. Overcome this by registering the cloned meta object in the QQmlMetaTypeData From now on, the cloned extension meta object has an associated QQmlType, which is the *extended* type, NOT the *extension* type Change-Id: I4a6a4380278b80e49e1b9874dd458183667e5cb5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlmetatype.cpp')
-rw-r--r--src/qml/qml/qqmlmetatype.cpp16
1 files changed, 13 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);
}
}