aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlplugindump/main.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2025-06-03 14:35:29 +0200
committerUlf Hermann <ulf.hermann@qt.io>2025-06-17 07:00:33 +0200
commitd2bc4a4330254c0c68a0ade51b59a71c4b67b470 (patch)
tree8345312f50df0be783618fd75a1d7e52c2ca65d7 /tools/qmlplugindump/main.cpp
parent8e0810c19c791386fd5f2cefc6b992f45be21750 (diff)
QtQml: Hold QQmlTypeLoader in QV4::ExecutionEngine
... rather than QQmlEngine. This paves the way for having the type loader attached to ExecutionEngine rather than QQmlEngine. Also, reference the execution engine in the type loader, in turn. Task-number: QTBUG-19407 Change-Id: I04e571c5c6ac5bce5e82537cb96c6940c7186f3a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools/qmlplugindump/main.cpp')
-rw-r--r--tools/qmlplugindump/main.cpp39
1 files changed, 20 insertions, 19 deletions
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index c6c96dcd90..36907a7edf 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -142,12 +142,13 @@ void collectReachableMetaObjects(QObject *object, QSet<const QMetaObject *> *met
}
}
-void collectReachableMetaObjects(QQmlEnginePrivate *engine, const QQmlType &ty, QSet<const QMetaObject *> *metas, const QmlVersionInfo& info)
+void collectReachableMetaObjects(
+ QQmlTypeLoader *typeLoader, const QQmlType &ty, QSet<const QMetaObject *> *metas,
+ const QmlVersionInfo& info)
{
collectReachableMetaObjects(ty.baseMetaObject(), metas, info, ty.isExtendedType());
- if (ty.attachedPropertiesType(engine) && matchingImportUri(ty, info)) {
- collectReachableMetaObjects(ty.attachedPropertiesType(engine), metas, info);
- }
+ if (ty.attachedPropertiesType(typeLoader) && matchingImportUri(ty, info))
+ collectReachableMetaObjects(ty.attachedPropertiesType(typeLoader), metas, info);
}
/* When we dump a QMetaObject, we want to list all the types it is exported as.
@@ -197,13 +198,14 @@ QByteArray convertToId(const QMetaObject *mo)
// Collect all metaobjects for types registered with qmlRegisterType() without parameters
-void collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate *engine, QSet<const QMetaObject *>& metas,
- QMap<QString, QList<QQmlType>> &compositeTypes, const QmlVersionInfo &info) {
+void collectReachableMetaObjectsWithoutQmlName(
+ QQmlTypeLoader *typeLoader, QSet<const QMetaObject *>& metas,
+ QMap<QString, QList<QQmlType>> &compositeTypes, const QmlVersionInfo &info) {
const auto qmlAllTypes = QQmlMetaType::qmlAllTypes();
for (const QQmlType &ty : qmlAllTypes) {
if (!metas.contains(ty.baseMetaObject())) {
if (!ty.isComposite()) {
- collectReachableMetaObjects(engine, ty, &metas, info);
+ collectReachableMetaObjects(typeLoader, ty, &metas, info);
} else if (matchingImportUri(ty, info)) {
compositeTypes[ty.elementName()].append(ty);
}
@@ -211,13 +213,10 @@ void collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate *engine, QSet<c
}
}
-QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
- QSet<const QMetaObject *> &noncreatables,
- QSet<const QMetaObject *> &singletons,
- QMap<QString, QList<QQmlType>> &compositeTypes,
- const QmlVersionInfo &info,
- const QList<QQmlType> &skip = QList<QQmlType>()
- )
+QSet<const QMetaObject *> collectReachableMetaObjects(
+ QQmlEngine *engine, QSet<const QMetaObject *> &noncreatables,
+ QSet<const QMetaObject *> &singletons, QMap<QString, QList<QQmlType>> &compositeTypes,
+ const QmlVersionInfo &info, const QList<QQmlType> &skip = QList<QQmlType>())
{
QSet<const QMetaObject *> metas;
metas.insert(&Qt::staticMetaObject);
@@ -233,7 +232,7 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
if (!ty.isComposite()) {
if (const QMetaObject *mo = ty.baseMetaObject())
qmlTypesByCppName[mo->className()].insert(ty);
- collectReachableMetaObjects(QQmlEnginePrivate::get(engine), ty, &metas, info);
+ collectReachableMetaObjects(QQmlTypeLoader::get(engine), ty, &metas, info);
} else {
compositeTypes[ty.elementName()].append(ty);
}
@@ -302,7 +301,7 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
}
}
- collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate::get(engine), metas, compositeTypes, info);
+ collectReachableMetaObjectsWithoutQmlName(QQmlTypeLoader::get(engine), metas, compositeTypes, info);
return metas;
}
@@ -535,7 +534,8 @@ public:
QByteArray attachedTypeId;
};
- void dump(QQmlEnginePrivate *engine, const QMetaObject *meta, bool isUncreatable, bool isSingleton)
+ void dump(QQmlTypeLoader *typeLoader, const QMetaObject *meta,
+ bool isUncreatable, bool isSingleton)
{
qml->writeStartObject("Component");
@@ -548,7 +548,7 @@ public:
for (const QQmlType &type : types) {
const QMetaObject *extendedObject = type.extensionFunction() ? type.metaObject() : nullptr;
QByteArray attachedTypeId;
- if (const QMetaObject *attachedType = type.attachedPropertiesType(engine)) {
+ if (const QMetaObject *attachedType = type.attachedPropertiesType(typeLoader)) {
// Can happen when a type is registered that returns itself as attachedPropertiesType()
// because there is no creatable type to attach to.
if (attachedType != meta)
@@ -1355,7 +1355,8 @@ int main(int argc, char *argv[])
if (relocatable)
dumper.setRelocatableModuleUri(pluginImportUri);
for (const QMetaObject *meta : std::as_const(nameToMeta)) {
- dumper.dump(QQmlEnginePrivate::get(&engine), meta, uncreatableMetas.contains(meta), singletonMetas.contains(meta));
+ dumper.dump(QQmlTypeLoader::get(&engine), meta, uncreatableMetas.contains(meta),
+ singletonMetas.contains(meta));
}
QMap<QString, QList<QQmlType>>::const_iterator iter = compositeTypes.constBegin();