diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-12-16 05:35:44 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-12-16 05:43:05 (GMT) |
commit | 6fe6e803f08750534a6c14b4a2847a6ec1b29350 (patch) | |
tree | 78cfb1eab0de5f054c507d12376539c0740de4a4 /src/declarative/qml/qmlcompiler.cpp | |
parent | e528394f428ba815fe61e4d2f5248b9bd11db375 (diff) | |
download | Qt-6fe6e803f08750534a6c14b4a2847a6ec1b29350.zip Qt-6fe6e803f08750534a6c14b4a2847a6ec1b29350.tar.gz Qt-6fe6e803f08750534a6c14b4a2847a6ec1b29350.tar.bz2 |
Use the component name as the base class name for dynamic meta objects
when appropriate.
This allows for much improved debug presentation. e.g. what used to be shown as "QmlGraphicsRectangle_QML_3" can now be show as "MyComponent".
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 9df9b40..197cc0f 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -2182,6 +2182,14 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode) newClassName.append("_QML_"); int idx = classIndexCounter()->fetchAndAddRelaxed(1); newClassName.append(QByteArray::number(idx)); + if (compileState.root == obj) { + QString path = output->url.path(); + int lastSlash = path.lastIndexOf(QLatin1Char('/')); + if (lastSlash > -1) { + QString nameBase = path.mid(lastSlash + 1, path.length()-lastSlash-5); + newClassName = nameBase.toUtf8() + "_QMLTYPE_" + QByteArray::number(idx); + } + } QMetaObjectBuilder builder; builder.setClassName(newClassName); |