summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Pesch <dpesch@blackberry.com>2014-01-22 22:18:59 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-29 12:18:02 +0100
commitf0be67b54d2b82ef57c9e3ff02b89e92b0ce2e96 (patch)
tree5b29eff3a2fa23c20bbe2a4468ac6fc90cb180a8 /tools
parentf7b3072924fb57b3979ff4d536eb213270be1047 (diff)
downloadqt4-tools-f0be67b54d2b82ef57c9e3ff02b89e92b0ce2e96.tar.gz
qmlplugindump is missing --noinstantiate option on Qt 4.8
Backport of --noinstantiate option from Qt 5.0. Task-number: QTBUG-36380 Change-Id: I80694aa94c5d5cceaf2751d1e3efc80e4f316709 Signed-off-by: Daniel Pesch <dpesch@blackberry.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlplugindump/main.cpp60
1 files changed, 33 insertions, 27 deletions
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index cf422cdfb5..ecb10e7d3e 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -67,6 +67,7 @@
QString pluginImportPath;
bool verbose = false;
+bool creatable = true;
QString currentProperty;
QString inObjectInstantiation;
@@ -218,31 +219,33 @@ QSet<const QMetaObject *> collectReachableMetaObjects(const QList<QDeclarativeTy
qmlTypesByCppName[baseCpp] = baseExports;
}
- // find even more QMetaObjects by instantiating QML types and running
- // over the instances
- foreach (QDeclarativeType *ty, QDeclarativeMetaType::qmlTypes()) {
- if (skip.contains(ty))
- continue;
- if (ty->isExtendedType())
- continue;
- if (!ty->isCreatable())
- continue;
- if (ty->typeName() == "QDeclarativeComponent")
- continue;
-
- QByteArray tyName = ty->qmlTypeName();
- tyName = tyName.mid(tyName.lastIndexOf('/') + 1);
- if (tyName.isEmpty())
- continue;
-
- inObjectInstantiation = tyName;
- QObject *object = ty->create();
- inObjectInstantiation.clear();
-
- if (object)
- collectReachableMetaObjects(object, &metas);
- else
- qWarning() << "Could not create" << tyName;
+ if (creatable) {
+ // find even more QMetaObjects by instantiating QML types and running
+ // over the instances
+ foreach (QDeclarativeType *ty, QDeclarativeMetaType::qmlTypes()) {
+ if (skip.contains(ty))
+ continue;
+ if (ty->isExtendedType())
+ continue;
+ if (!ty->isCreatable())
+ continue;
+ if (ty->typeName() == "QDeclarativeComponent")
+ continue;
+
+ QByteArray tyName = ty->qmlTypeName();
+ tyName = tyName.mid(tyName.lastIndexOf('/') + 1);
+ if (tyName.isEmpty())
+ continue;
+
+ inObjectInstantiation = tyName;
+ QObject *object = ty->create();
+ inObjectInstantiation.clear();
+
+ if (object)
+ collectReachableMetaObjects(object, &metas);
+ else
+ qWarning() << "Could not create" << tyName;
+ }
}
return metas;
@@ -482,8 +485,8 @@ void sigSegvHandler(int) {
void printUsage(const QString &appName)
{
qWarning() << qPrintable(QString(
- "Usage: %1 [-v] [-[non]relocatable] module.uri version [module/import/path]\n"
- " %1 [-v] -path path/to/qmldir/directory [version]\n"
+ "Usage: %1 [-v] [-noinstantiate] [-[non]relocatable] module.uri version [module/import/path]\n"
+ " %1 [-v] [-noinstantiate] -path path/to/qmldir/directory [version]\n"
" %1 [-v] -builtins\n"
"Example: %1 Qt.labs.particles 4.7 /home/user/dev/qt-install/imports").arg(
appName));
@@ -544,6 +547,9 @@ int main(int argc, char *argv[])
action = Builtins;
} else if (arg == QLatin1String("-v")) {
verbose = true;
+ } else if (arg == QLatin1String("--noinstantiate")
+ || arg == QLatin1String("-noinstantiate")) {
+ creatable = false;
} else {
qWarning() << "Invalid argument: " << arg;
return EXIT_INVALIDARGUMENTS;