diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-12-12 10:47:53 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2025-12-13 10:07:01 +0100 |
| commit | ea9fbd9b6766f44e0d31e114d1c9658b2a9c610f (patch) | |
| tree | 4b2fbefc74541225be9008965600a059b5b4ccc2 | |
| parent | cdff49bfeb66da75f486a8eeb897517d93d78008 (diff) | |
Nobody needs to modify QQmlTypePrivate once it's created.
Change-Id: I8c28cf1ce64852576df671e663f9d00b419e3350
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
| -rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 6 | ||||
| -rw-r--r-- | src/qml/qml/qqmlmetatype_p.h | 2 | ||||
| -rw-r--r-- | src/qml/qml/qqmlmetatypedata_p.h | 2 | ||||
| -rw-r--r-- | src/qml/qml/qqmltype.cpp | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 754d2713a7..248533a155 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -1537,7 +1537,7 @@ void QQmlMetaType::unregisterType(int typeIndex) } } -void QQmlMetaType::registerMetaObjectForType(const QMetaObject *metaobject, QQmlTypePrivate *type) +void QQmlMetaType::registerMetaObjectForType(const QMetaObject *metaobject, const QQmlTypePrivate *type) { Q_ASSERT(type); @@ -1822,7 +1822,7 @@ QList<QQmlProxyMetaObject::ProxyData> QQmlMetaType::proxyData(const QMetaObject if (!mo) return metaObjects; - auto createProxyMetaObject = [&](QQmlTypePrivate *This, + auto createProxyMetaObject = [&](const QQmlTypePrivate *This, const QMetaObject *superdataBaseMetaObject, const QMetaObject *extMetaObject, QObject *(*extFunc)(QObject *)) { @@ -1850,7 +1850,7 @@ QList<QQmlProxyMetaObject::ProxyData> QQmlMetaType::proxyData(const QMetaObject // loaded before. Just adding all possible extensions would also be pretty random. // The right way to do this would be to take the relations between the QML modules // into account. For this we would need proper module dependency information. - if (QQmlTypePrivate *t = data->metaObjectToType.value(mo)) { + if (const QQmlTypePrivate *t = data->metaObjectToType.value(mo)) { if (t->regType == QQmlType::CppType) { createProxyMetaObject( t, t->baseMetaObject, t->extraData.cppTypeData->extMetaObject, diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h index 01ce721781..f60f77487f 100644 --- a/src/qml/qml/qqmlmetatype_p.h +++ b/src/qml/qml/qqmlmetatype_p.h @@ -121,7 +121,7 @@ public: static void unregisterType(int type); - static void registerMetaObjectForType(const QMetaObject *metaobject, QQmlTypePrivate *type); + static void registerMetaObjectForType(const QMetaObject *metaobject, const QQmlTypePrivate *type); static void registerModule(const char *uri, QTypeRevision version); static bool protectModule(const QString &uri, QTypeRevision version, diff --git a/src/qml/qml/qqmlmetatypedata_p.h b/src/qml/qml/qqmlmetatypedata_p.h index 0157f1e1f2..416f9d61fb 100644 --- a/src/qml/qml/qqmlmetatypedata_p.h +++ b/src/qml/qml/qqmlmetatypedata_p.h @@ -43,7 +43,7 @@ struct QQmlMetaTypeData typedef QHash<QUrl, const QQmlTypePrivate *> Files; //For file imported composite types only Files urlToType; - typedef QMultiHash<const QMetaObject *, QQmlTypePrivate *> MetaObjects; + typedef QMultiHash<const QMetaObject *, const QQmlTypePrivate *> MetaObjects; MetaObjects metaObjectToType; QVector<QHash<QTypeRevision, QQmlPropertyCache::ConstPtr>> typePropertyCaches; QHash<int, QQmlValueType *> metaTypeToValueType; diff --git a/src/qml/qml/qqmltype.cpp b/src/qml/qml/qqmltype.cpp index 89f9df7078..ee61514d6e 100644 --- a/src/qml/qml/qqmltype.cpp +++ b/src/qml/qml/qqmltype.cpp @@ -208,7 +208,7 @@ const QQmlTypePrivate::ProxyMetaObjects *QQmlTypePrivate::init() const mmo->d.superdata = mo; QQmlProxyMetaObject::ProxyData data = { mmo, extFunc, 0, 0 }; metaObjects << data; - QQmlMetaType::registerMetaObjectForType(mmo, const_cast<QQmlTypePrivate *>(this)); + QQmlMetaType::registerMetaObjectForType(mmo, this); }; if (regType == QQmlType::SingletonType) |
