diff options
author | Fawzi Mohamed <fawzi.mohamed@digia.com> | 2013-04-09 16:26:20 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-18 08:12:01 (GMT) |
commit | 7d9f5d1925cdc03a7fd1293fd02bf0cf72191867 (patch) | |
tree | 26870b0849d0933a592d3c0e8f89fe97b46d9144 /tools | |
parent | 00fa49b42ea931c3f8b2bb46e490fccf28e44744 (diff) | |
download | Qt-7d9f5d1925cdc03a7fd1293fd02bf0cf72191867.zip Qt-7d9f5d1925cdc03a7fd1293fd02bf0cf72191867.tar.gz Qt-7d9f5d1925cdc03a7fd1293fd02bf0cf72191867.tar.bz2 |
qmlplugindump: correctly handle various versions of a meta object
Change-Id: I2775c2cf4a3a2b1295d389da665e5e8aadea21e9
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmlplugindump/main.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index da29b28..b96a726 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -282,7 +282,7 @@ public: QSet<const QDeclarativeType *> qmlTypes = qmlTypesByCppName.value(meta->className()); if (!qmlTypes.isEmpty()) { - QStringList exports; + QHash<QString, const QDeclarativeType *> exports; foreach (const QDeclarativeType *qmlTy, qmlTypes) { QString qmlTyName = qmlTy->qmlTypeName(); @@ -295,17 +295,26 @@ public: if (qmlTyName.startsWith("./")) { qmlTyName.remove(0, 2); } - exports += enquote(QString("%1 %2.%3").arg( - qmlTyName, - QString::number(qmlTy->majorVersion()), - QString::number(qmlTy->minorVersion()))); + const QString exportString = enquote( + QString("%1 %2.%3").arg( + qmlTyName, + QString::number(qmlTy->majorVersion()), + QString::number(qmlTy->minorVersion()))); + exports.insert(exportString, qmlTy); } // ensure exports are sorted and don't change order when the plugin is dumped again - exports.removeDuplicates(); - qSort(exports); - - qml->writeArrayBinding(QLatin1String("exports"), exports); + QStringList exportStrings = exports.keys(); + qSort(exportStrings); + qml->writeArrayBinding(QLatin1String("exports"), exportStrings); + + // write meta object revisions + QStringList metaObjectRevisions; + foreach (const QString &exportString, exportStrings) { + int metaObjectRevision = exports[exportString]->metaObjectRevision(); + metaObjectRevisions += QString::number(metaObjectRevision); + } + qml->writeArrayBinding(QLatin1String("exportMetaObjectRevisions"), metaObjectRevisions); if (const QMetaObject *attachedType = (*qmlTypes.begin())->attachedPropertiesType()) { // Can happen when a type is registered that returns itself as attachedPropertiesType() |