aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorCaroline Chao <caroline.chao@digia.com>2013-09-16 12:40:30 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-17 15:39:15 +0200
commit739483926b243162f660f0a363a8ce051c21c38d (patch)
treeedb97b00b65f87b68aaaaee518eda37a7887f735 /tools
parent37492efee021ccc6e550ecb67a3240b76eb2219e (diff)
qmlplugindump: fix prototypes identification for composite types
The prototype name for the composite type is the first "default" prototype found in the reachable types. If none is found then the default value is QObject. Change-Id: I40b4fefaab40e4c9f83d24c89bd026579be63e7b Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlplugindump/main.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index f312604e17..854a63756e 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -352,23 +352,23 @@ public:
}
}
- QString getPrototypeNameForCompositeType(const QMetaObject *metaObject)
+ QString getPrototypeNameForCompositeType(const QMetaObject *metaObject, QSet<QByteArray> &defaultReachableNames)
{
QString prototypeName;
- const QMetaObject *superMetaObject = metaObject->superClass();
- if (!superMetaObject)
- return "QObject";
- QString className = convertToId(superMetaObject->className());
- if (className.startsWith("QQuick"))
- prototypeName = className;
- else
- prototypeName = getPrototypeNameForCompositeType(superMetaObject);
+ if (!defaultReachableNames.contains(metaObject->className())) {
+ const QMetaObject *superMetaObject = metaObject->superClass();
+ if (!superMetaObject)
+ prototypeName = "QObject";
+ else
+ prototypeName = getPrototypeNameForCompositeType(superMetaObject, defaultReachableNames);
+ } else {
+ prototypeName = convertToId(metaObject->className());
+ }
return prototypeName;
}
void dumpComposite(QQmlEngine *engine, const QQmlType *compositeType, QSet<QByteArray> &defaultReachableNames)
{
-
QQmlComponent e(engine, compositeType->sourceUrl());
QObject *object = e.create();
@@ -380,7 +380,7 @@ public:
const QMetaObject *mainMeta = object->metaObject();
// Get C++ base class name for the composite type
- QString prototypeName = getPrototypeNameForCompositeType(mainMeta);
+ QString prototypeName = getPrototypeNameForCompositeType(mainMeta, defaultReachableNames);
qml->writeScriptBinding(QLatin1String("prototype"), enquote(prototypeName));
QString qmlTyName = compositeType->qmlTypeName();