diff options
author | Daniel Pesch <dpesch@blackberry.com> | 2014-01-22 21:18:59 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-29 11:18:02 (GMT) |
commit | f0be67b54d2b82ef57c9e3ff02b89e92b0ce2e96 (patch) | |
tree | 5b29eff3a2fa23c20bbe2a4468ac6fc90cb180a8 /tools | |
parent | f7b3072924fb57b3979ff4d536eb213270be1047 (diff) | |
download | Qt-f0be67b54d2b82ef57c9e3ff02b89e92b0ce2e96.zip Qt-f0be67b54d2b82ef57c9e3ff02b89e92b0ce2e96.tar.gz Qt-f0be67b54d2b82ef57c9e3ff02b89e92b0ce2e96.tar.bz2 |
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.cpp | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index cf422cd..ecb10e7 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; |