summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2019-03-01 17:04:41 +0100
committerKai Koehne <kai.koehne@qt.io>2019-03-04 13:41:19 +0000
commit073977a7a1e79d0cf4ebeaa044045986f29c1d04 (patch)
tree51e55e277f141f41c2d033b7c44e18a1960cccb3 /tools
parent1c7213dbc00fa595aeaa98ad5631bac56782599e (diff)
qmlplugindump: Make compositeTypes non-static
Change-Id: Ia4f35781ed96a347464b5e423bd7446f5a7f6752 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlplugindump/main.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index f5bd6d2291..06dd6abe2b 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -163,10 +163,6 @@ public:
*/
static QHash<QByteArray, QSet<QQmlType> > qmlTypesByCppName;
-/* A composite type is completely specified by name, major version and minor version.
-*/
-static QMap<QString, QSet<QQmlType> > qmlTypesByCompositeName;
-
static QHash<QByteArray, QByteArray> cppToId;
/* Takes a C++ type name, such as Qt::LayoutDirection or QString and
@@ -208,14 +204,15 @@ QByteArray convertToId(const QMetaObject *mo)
// Collect all metaobjects for types registered with qmlRegisterType() without parameters
-void collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate *engine, QSet<const QMetaObject *>& metas ) {
+void collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate *engine, QSet<const QMetaObject *>& metas,
+ QMap<QString, QSet<QQmlType>> &compositeTypes) {
const auto qmlAllTypes = QQmlMetaType::qmlAllTypes();
for (const QQmlType &ty : qmlAllTypes) {
if (!metas.contains(ty.baseMetaObject())) {
if (!ty.isComposite()) {
collectReachableMetaObjects(engine, ty, &metas);
} else {
- qmlTypesByCompositeName[ty.elementName()].insert(ty);
+ compositeTypes[ty.elementName()].insert(ty);
}
}
}
@@ -224,6 +221,7 @@ void collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate *engine, QSet<c
QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
QSet<const QMetaObject *> &noncreatables,
QSet<const QMetaObject *> &singletons,
+ QMap<QString, QSet<QQmlType>> &compositeTypes,
const QList<QQmlType> &skip = QList<QQmlType>())
{
QSet<const QMetaObject *> metas;
@@ -239,7 +237,7 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
qmlTypesByCppName[ty.baseMetaObject()->className()].insert(ty);
collectReachableMetaObjects(QQmlEnginePrivate::get(engine), ty, &metas);
} else {
- qmlTypesByCompositeName[ty.elementName()].insert(ty);
+ compositeTypes[ty.elementName()].insert(ty);
}
}
@@ -304,7 +302,7 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
}
}
- collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate::get(engine), metas);
+ collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate::get(engine), metas, compositeTypes);
return metas;
}
@@ -1185,7 +1183,8 @@ int main(int argc, char *argv[])
// find all QMetaObjects reachable from the builtin module
QSet<const QMetaObject *> uncreatableMetas;
QSet<const QMetaObject *> singletonMetas;
- QSet<const QMetaObject *> defaultReachable = collectReachableMetaObjects(&engine, uncreatableMetas, singletonMetas);
+ QMap<QString, QSet<QQmlType>> compositeTypes;
+ QSet<const QMetaObject *> defaultReachable = collectReachableMetaObjects(&engine, uncreatableMetas, singletonMetas, compositeTypes);
QList<QQmlType> defaultTypes = QQmlMetaType::qmlTypes();
// add some otherwise unreachable QMetaObjects
@@ -1269,7 +1268,7 @@ int main(int argc, char *argv[])
}
}
- QSet<const QMetaObject *> candidates = collectReachableMetaObjects(&engine, uncreatableMetas, singletonMetas, defaultTypes);
+ QSet<const QMetaObject *> candidates = collectReachableMetaObjects(&engine, uncreatableMetas, singletonMetas, compositeTypes, defaultTypes);
candidates.subtract(defaultReachable);
// Also eliminate meta objects with the same classname.
@@ -1325,8 +1324,8 @@ int main(int argc, char *argv[])
dumper.dump(QQmlEnginePrivate::get(&engine), meta, uncreatableMetas.contains(meta), singletonMetas.contains(meta));
}
- QMap<QString, QSet<QQmlType> >::const_iterator iter = qmlTypesByCompositeName.constBegin();
- for (; iter != qmlTypesByCompositeName.constEnd(); ++iter)
+ QMap<QString, QSet<QQmlType> >::const_iterator iter = compositeTypes.constBegin();
+ for (; iter != compositeTypes.constEnd(); ++iter)
dumper.dumpComposite(&engine, iter.value(), defaultReachableNames);
// define QEasingCurve as an extension of QQmlEasingValueType, this way