diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-05 06:41:00 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-05 06:41:00 (GMT) |
commit | aaf6ebb3725055035d0d17767b4e155d39828553 (patch) | |
tree | ccff66bd71e661955fc5d9af0dea15bd40e7a08d /tools | |
parent | 601b12b7879e9a743ef9e516470219aae73e611d (diff) | |
parent | d4740963fa6284407c74c49ea587b0511c9bc4c9 (diff) | |
download | Qt-aaf6ebb3725055035d0d17767b4e155d39828553.zip Qt-aaf6ebb3725055035d0d17767b4e155d39828553.tar.gz Qt-aaf6ebb3725055035d0d17767b4e155d39828553.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:
Flicking behaviour of ListView/GridView SnapOnItem is inconsistent
Skip flick velocity test on Mac.
Try again to fix flickable velocity on Mac.
Try to fix Mac CI test failure
qmlplugindump: Fix dumping with -path on Mac.
qmlplugindump: Improve error message for misbehaving plugin components.
Flickable is too sensitive.
Reduce timing dependancy in flickable test
Velocities reported by Flickable in onFlickStarted can be 0
qmldump: Fix export comparison.
QmlInspector: Some code cleanups
QmlInspector: Some cleanup in the Color Picker tool
QmlInspector: Unified mouse and keyboard event handling
QmlInspector: Removed private header postfix and Qt namespace
QmlInspector: Share code between QGV/SG based QML debugging
qmlplugindump: For extended types, remove exports of the base object.
qmlplugindump: Build debug version if possible.
QDeclarativeDebug: Add code coverage information
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmlplugindump/main.cpp | 69 | ||||
-rw-r--r-- | tools/qmlplugindump/qmlplugindump.pro | 17 |
2 files changed, 62 insertions, 24 deletions
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index 403e3b6..ae06d02 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -68,6 +68,9 @@ QString pluginImportPath; bool verbose = false; +QString currentProperty; +QString inObjectInstantiation; + void collectReachableMetaObjects(const QMetaObject *meta, QSet<const QMetaObject *> *metas) { if (! meta || metas->contains(meta)) @@ -81,8 +84,6 @@ void collectReachableMetaObjects(const QMetaObject *meta, QSet<const QMetaObject collectReachableMetaObjects(meta->superClass(), metas); } -QString currentProperty; - void collectReachableMetaObjects(QObject *object, QSet<const QMetaObject *> *metas) { if (! object) @@ -160,29 +161,36 @@ QSet<const QMetaObject *> collectReachableMetaObjects(const QString &importCode, collectReachableMetaObjects(ty, &metas); } - // Adjust ids of extended objects. - // The chain ends up being: - // __extended__.originalname - the base object - // __extension_0_.originalname - first extension - // .. - // __extension_n-2_.originalname - second to last extension - // originalname - last extension - // ### does this actually work for multiple extensions? it seems like the prototypes might be wrong - foreach (const QByteArray &extendedCpp, extensions.keys()) { - cppToId.remove(extendedCpp); - const QByteArray extendedId = convertToId(extendedCpp); - cppToId.insert(extendedCpp, "__extended__." + extendedId); - QSet<QByteArray> extensionCppNames = extensions.value(extendedCpp); - int c = 0; + // Adjust exports of the base object if there are extensions. + // For each export of a base object there can be a single extension object overriding it. + // Example: QDeclarativeGraphicsWidget overrides the QtQuick/QGraphicsWidget export + // of QGraphicsWidget. + foreach (const QByteArray &baseCpp, extensions.keys()) { + QSet<const QDeclarativeType *> baseExports = qmlTypesByCppName.value(baseCpp); + + const QSet<QByteArray> extensionCppNames = extensions.value(baseCpp); foreach (const QByteArray &extensionCppName, extensionCppNames) { - if (c != extensionCppNames.size() - 1) { - QByteArray adjustedName = QString("__extension__%1.%2").arg(QString::number(c), QString(extendedId)).toAscii(); - cppToId.insert(extensionCppName, adjustedName); - } else { - cppToId.insert(extensionCppName, extendedId); + const QSet<const QDeclarativeType *> extensionExports = qmlTypesByCppName.value(extensionCppName); + + // remove extension exports from base imports + // unfortunately the QDeclarativeType pointers don't match, so can't use QSet::substract + QSet<const QDeclarativeType *> newBaseExports; + foreach (const QDeclarativeType *baseExport, baseExports) { + bool match = false; + foreach (const QDeclarativeType *extensionExport, extensionExports) { + if (baseExport->qmlTypeName() == extensionExport->qmlTypeName() + && baseExport->majorVersion() == extensionExport->majorVersion() + && baseExport->minorVersion() == extensionExport->minorVersion()) { + match = true; + break; + } + } + if (!match) + newBaseExports.insert(baseExport); } - ++c; + baseExports = newBaseExports; } + qmlTypesByCppName[baseCpp] = baseExports; } // find even more QMetaObjects by instantiating QML types and running @@ -207,7 +215,10 @@ QSet<const QMetaObject *> collectReachableMetaObjects(const QString &importCode, QDeclarativeComponent c(engine); c.setData(code, QUrl::fromLocalFile(pluginImportPath + "/typeinstance.qml")); + inObjectInstantiation = tyName; QObject *object = c.create(); + inObjectInstantiation.clear(); + if (object) collectReachableMetaObjects(object, &metas); else @@ -261,6 +272,9 @@ public: if (qmlTyName.startsWith(relocatableModuleUri + QLatin1Char('/'))) { qmlTyName.remove(0, relocatableModuleUri.size() + 1); } + if (qmlTyName.startsWith("./")) { + qmlTyName.remove(0, 2); + } exports += enquote(QString("%1 %2.%3").arg( qmlTyName, QString::number(qmlTy->majorVersion()), @@ -426,6 +440,8 @@ void sigSegvHandler(int) { fprintf(stderr, "Error: SEGV\n"); if (!currentProperty.isEmpty()) fprintf(stderr, "While processing the property '%s', which probably has uninitialized data.\n", currentProperty.toLatin1().constData()); + if (!inObjectInstantiation.isEmpty()) + fprintf(stderr, "While instantiating the object '%s'.\n", inObjectInstantiation.toLatin1().constData()); exit(EXIT_SEGV); } #endif @@ -523,11 +539,16 @@ int main(int argc, char *argv[]) QDeclarativeView view; QDeclarativeEngine *engine = view.engine(); - if (!pluginImportPath.isEmpty()) + if (!pluginImportPath.isEmpty()) { + QDir cur = QDir::current(); + cur.cd(pluginImportPath); + pluginImportPath = cur.absolutePath(); + QDir::setCurrent(pluginImportPath); engine->addImportPath(pluginImportPath); + } // find all QMetaObjects reachable from the builtin module - QByteArray importCode("import QtQuick 1.1\n"); + QByteArray importCode("import QtQuick 1.0\n"); QSet<const QMetaObject *> defaultReachable = collectReachableMetaObjects(importCode, engine); // this will hold the meta objects we want to dump information of diff --git a/tools/qmlplugindump/qmlplugindump.pro b/tools/qmlplugindump/qmlplugindump.pro index 53827e2..e9fcdc7 100644 --- a/tools/qmlplugindump/qmlplugindump.pro +++ b/tools/qmlplugindump/qmlplugindump.pro @@ -16,5 +16,22 @@ HEADERS += \ OTHER_FILES += Info.plist macx: QMAKE_INFO_PLIST = Info.plist +# Build debug and release versions of the tool on Windows - +# if debug and release versions of Qt have been built. +!build_pass:win32 { + CONFIG -= debug release debug_and_release build_all + + contains(QT_CONFIG,debug):contains(QT_CONFIG,release) { + CONFIG += debug_and_release build_all + } else { + contains(QT_CONFIG,debug): CONFIG += debug + contains(QT_CONFIG,release): CONFIG += release + } +} + +CONFIG(debug, debug|release) { + win32: TARGET = $$join(TARGET,,,d) +} + target.path = $$[QT_INSTALL_BINS] INSTALLS += target |