diff options
Diffstat (limited to 'tools/qmlplugindump/main.cpp')
| -rw-r--r-- | tools/qmlplugindump/main.cpp | 39 |
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(); |
