aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pesch <dpesch@blackberry.com>2014-01-20 18:37:32 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-21 09:14:29 +0100
commit1b53fb1b6f00fe6bef787d385dddc48d52b090c6 (patch)
tree555282bb3bfa50a44991c30d67c4af91cd89faab
parent4c5cd2f04fdaf946cc67896db7c190a318811d86 (diff)
qmplugindump is not able to dump all registered components
This patch implements a new function QQmlMetaType::qmlAllTypes() used by qmlplugindump that returns list of all registered components. Previous implementation used QQmlMetaType::qmlATypes() call that returned only components with defined QML name. Task-number: QTBUG-36199 Change-Id: I85acba61cfa511973a004934cf0650f38cc46ed9 Signed-off-by: Daniel Pesch <dpesch@blackberry.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
-rw-r--r--src/qml/qml/qqmlmetatype.cpp11
-rw-r--r--src/qml/qml/qqmlmetatype_p.h1
-rw-r--r--tools/qmlplugindump/main.cpp16
3 files changed, 28 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index ed0c0afd6f..37f26a236f 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -1836,6 +1836,17 @@ QList<QQmlType*> QQmlMetaType::qmlTypes()
}
/*!
+ Returns the list of all registered types.
+*/
+QList<QQmlType*> QQmlMetaType::qmlAllTypes()
+{
+ QReadLocker lock(metaTypeDataLock());
+ QQmlMetaTypeData *data = metaTypeData();
+
+ return data->types;
+}
+
+/*!
Returns the list of registered QML singleton types.
*/
QList<QQmlType*> QQmlMetaType::qmlSingletonTypes()
diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h
index 2f473f5f46..64f7702b64 100644
--- a/src/qml/qml/qqmlmetatype_p.h
+++ b/src/qml/qml/qqmlmetatype_p.h
@@ -80,6 +80,7 @@ public:
static QList<QString> qmlTypeNames();
static QList<QQmlType*> qmlTypes();
static QList<QQmlType*> qmlSingletonTypes();
+ static QList<QQmlType*> qmlAllTypes();
static QQmlType *qmlType(const QString &qualifiedName, int, int);
static QQmlType *qmlType(const QHashedStringRef &name, const QHashedStringRef &module, int, int);
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index 89af0905d5..000af0a1d8 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -182,6 +182,20 @@ QByteArray convertToId(const QMetaObject *mo)
return className;
}
+
+// Collect all metaobjects for types registered with qmlRegisterType() without parameters
+void collectReachableMetaObjectsWithoutQmlName( QSet<const QMetaObject *>& metas ) {
+ foreach (const QQmlType *ty, QQmlMetaType::qmlAllTypes()) {
+ if ( ! metas.contains(ty->metaObject()) ) {
+ if (!ty->isComposite()) {
+ collectReachableMetaObjects(ty, &metas);
+ } else {
+ qmlTypesByCompositeName[ty->elementName()] = ty;
+ }
+ }
+ }
+}
+
QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
QSet<const QMetaObject *> &noncreatables,
QSet<const QMetaObject *> &singletons,
@@ -298,6 +312,8 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
}
}
+ collectReachableMetaObjectsWithoutQmlName(metas);
+
return metas;
}