summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-11-23 20:06:53 +1000
committerQt Continuous Integration System <qt-info@nokia.com>2011-11-23 20:06:53 +1000
commit05ba0b4d0d32ea2a823aee0b5d196008d95a021d (patch)
treed02bf5f2552db299f2a906549f9c51d0f4de8b9d /tools
parent8960973e97713205d1aeb209806daca456c55111 (diff)
parent787a9ce07accfcaddada8235ae204a5aa2025309 (diff)
downloadqt4-tools-05ba0b4d0d32ea2a823aee0b5d196008d95a021d.tar.gz
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: Sequential reading not supported. DeclarativeDebugServer: Instantiate QPluginLoader on heap Fix failing unit tests. qmlplugindump: Fix dumping empty names for generated QMetaObjects. Fix compile with -qtnamespace Properly protect access to pixmap reader thread with mutex Move tga support from Qt3d to Qt. Move tga support from Qt3d to Qt. Properly protect access to pixmap reader thread with mutex qmlplugindump: Add flush to fix output redirection on windows.
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlplugindump/main.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index 6bef8d42f6..4f523b93fd 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -147,6 +147,31 @@ QByteArray convertToId(const QByteArray &cppName)
return cppToId.value(cppName, cppName);
}
+QByteArray convertToId(const QMetaObject *mo)
+{
+ QByteArray className(mo->className());
+ if (!className.isEmpty())
+ return convertToId(className);
+
+ // likely a metaobject generated for an extended qml object
+ if (mo->superClass()) {
+ className = convertToId(mo->superClass());
+ className.append("_extended");
+ return className;
+ }
+
+ static QHash<const QMetaObject *, QByteArray> generatedNames;
+ className = generatedNames.value(mo);
+ if (!className.isEmpty())
+ return className;
+
+ qWarning() << "Found a QMetaObject without a className, generating a random name";
+ className = QByteArray("error-unknown-name-");
+ className.append(QByteArray::number(generatedNames.size()));
+ generatedNames.insert(mo, className);
+ return className;
+}
+
QSet<const QMetaObject *> collectReachableMetaObjects(const QList<QDeclarativeType *> &skip = QList<QDeclarativeType *>())
{
QSet<const QMetaObject *> metas;
@@ -241,7 +266,7 @@ public:
{
qml->writeStartObject("Component");
- QByteArray id = convertToId(meta->className());
+ QByteArray id = convertToId(meta);
qml->writeScriptBinding(QLatin1String("name"), enquote(id));
for (int index = meta->classInfoCount() - 1 ; index >= 0 ; --index) {
@@ -253,7 +278,7 @@ public:
}
if (meta->superClass())
- qml->writeScriptBinding(QLatin1String("prototype"), enquote(convertToId(meta->superClass()->className())));
+ qml->writeScriptBinding(QLatin1String("prototype"), enquote(convertToId(meta->superClass())));
QSet<const QDeclarativeType *> qmlTypes = qmlTypesByCppName.value(meta->className());
if (!qmlTypes.isEmpty()) {
@@ -284,7 +309,7 @@ public:
if (const QMetaObject *attachedType = (*qmlTypes.begin())->attachedPropertiesType()) {
qml->writeScriptBinding(QLatin1String("attachedType"), enquote(
- convertToId(attachedType->className())));
+ convertToId(attachedType)));
}
}
@@ -624,7 +649,7 @@ int main(int argc, char *argv[])
// put the metaobjects into a map so they are always dumped in the same order
QMap<QString, const QMetaObject *> nameToMeta;
foreach (const QMetaObject *meta, metas)
- nameToMeta.insert(convertToId(meta->className()), meta);
+ nameToMeta.insert(convertToId(meta), meta);
Dumper dumper(&qml);
if (relocatable)
@@ -641,7 +666,7 @@ int main(int argc, char *argv[])
qml.writeEndObject();
qml.writeEndDocument();
- std::cout << bytes.constData();
+ std::cout << bytes.constData() << std::flush;
// workaround to avoid crashes on exit
QTimer timer;