diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-08-12 00:37:52 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-08-12 00:37:52 (GMT) |
commit | 3906239fca832896ebdd85d4fc80e083b0c2b5ce (patch) | |
tree | 569a2534a4d8ae589e6cef87c7ea6a5ef1dd47a0 /tools | |
parent | d014d3ab9a333cc9a9b2b60acc178019bd5c29ac (diff) | |
parent | 72c58996a5fc7c7a1a82fefa5a0034f57383e788 (diff) | |
download | Qt-3906239fca832896ebdd85d4fc80e083b0c2b5ce.zip Qt-3906239fca832896ebdd85d4fc80e083b0c2b5ce.tar.gz Qt-3906239fca832896ebdd85d4fc80e083b0c2b5ce.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-qml-staging:
QmlInspector: Fix moc error
QmlInspector: Fix compile for QT_NO_CURSOR
QmlInspector: Remove unused toolbar
JSDebugger: Only hit breakpoints in user code
Prevent Binding from crashing when its target object is deleted.
Cleanup QMLViewer properly when exiting via File->Quit.
Fix crash when assigning a list property to transitions.
Qml Debugging: only read properties that can be displayed in the debugger
qmldump: Fix creation of objects from QDeclarativeTypes.
Document state fast-forwarding.
qmlplugindump: Update qmltypes file format documentation.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qml/qmlruntime.cpp | 1 | ||||
-rw-r--r-- | tools/qmlplugindump/main.cpp | 37 |
2 files changed, 24 insertions, 14 deletions
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 4b0f2d5..f9961bc 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -1393,6 +1393,7 @@ void QDeclarativeViewer::appAboutToQuit() loggerWindow = 0; delete tester; tester = 0; + close(); } void QDeclarativeViewer::autoStartRecording() diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index ae06d02..6bef8d4 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -147,7 +147,7 @@ QByteArray convertToId(const QByteArray &cppName) return cppToId.value(cppName, cppName); } -QSet<const QMetaObject *> collectReachableMetaObjects(const QString &importCode, QDeclarativeEngine *engine) +QSet<const QMetaObject *> collectReachableMetaObjects(const QList<QDeclarativeType *> &skip = QList<QDeclarativeType *>()) { QSet<const QMetaObject *> metas; metas.insert(FriendlyQObject::qtMeta()); @@ -195,7 +195,9 @@ QSet<const QMetaObject *> collectReachableMetaObjects(const QString &importCode, // find even more QMetaObjects by instantiating QML types and running // over the instances - foreach (const QDeclarativeType *ty, QDeclarativeMetaType::qmlTypes()) { + foreach (QDeclarativeType *ty, QDeclarativeMetaType::qmlTypes()) { + if (skip.contains(ty)) + continue; if (ty->isExtendedType()) continue; if (!ty->isCreatable()) @@ -208,21 +210,14 @@ QSet<const QMetaObject *> collectReachableMetaObjects(const QString &importCode, if (tyName.isEmpty()) continue; - QByteArray code = importCode.toUtf8(); - code += tyName; - code += " {}\n"; - - QDeclarativeComponent c(engine); - c.setData(code, QUrl::fromLocalFile(pluginImportPath + "/typeinstance.qml")); - inObjectInstantiation = tyName; - QObject *object = c.create(); + QObject *object = ty->create(); inObjectInstantiation.clear(); if (object) collectReachableMetaObjects(object, &metas); else - qWarning() << "Could not create" << tyName << ":" << c.errorString(); + qWarning() << "Could not create" << tyName; } return metas; @@ -548,8 +543,8 @@ int main(int argc, char *argv[]) } // find all QMetaObjects reachable from the builtin module - QByteArray importCode("import QtQuick 1.0\n"); - QSet<const QMetaObject *> defaultReachable = collectReachableMetaObjects(importCode, engine); + QSet<const QMetaObject *> defaultReachable = collectReachableMetaObjects(); + QList<QDeclarativeType *> defaultTypes = QDeclarativeMetaType::qmlTypes(); // this will hold the meta objects we want to dump information of QSet<const QMetaObject *> metas; @@ -557,6 +552,20 @@ int main(int argc, char *argv[]) if (action == Builtins) { metas = defaultReachable; } else { + // find a valid QtQuick import + QByteArray importCode; + QDeclarativeType *qtObjectType = QDeclarativeMetaType::qmlType(&QObject::staticMetaObject); + if (!qtObjectType) { + qWarning() << "Could not find QtObject type"; + importCode = QByteArray("import QtQuick 1.0\n"); + } else { + QByteArray module = qtObjectType->qmlTypeName(); + module = module.mid(0, module.lastIndexOf('/')); + importCode = QString("import %1 %2.%3\n").arg(module, + QString::number(qtObjectType->majorVersion()), + QString::number(qtObjectType->minorVersion())).toUtf8(); + } + // find all QMetaObjects reachable when the specified module is imported if (action != Path) { importCode += QString("import %0 %1\n").arg(pluginImportUri, pluginImportVersion).toAscii(); @@ -581,7 +590,7 @@ int main(int argc, char *argv[]) } } - QSet<const QMetaObject *> candidates = collectReachableMetaObjects(importCode, engine); + QSet<const QMetaObject *> candidates = collectReachableMetaObjects(defaultTypes); candidates.subtract(defaultReachable); // Also eliminate meta objects with the same classname. |