aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlinfo.cpp
diff options
context:
space:
mode:
authorTobias Koenig <tobias.koenig@kdab.com>2015-09-24 12:45:22 +0200
committerTobias Koenig <tobias.koenig@kdab.com>2015-09-24 11:11:32 +0000
commitfe7d35e3cbc7b6db42fbc66e26a63d321260cea0 (patch)
treeb055a92ff980fa9f57bd5f6b12355aa1045f93a1 /src/qml/qml/qqmlinfo.cpp
parent0e90fac4afeda889c38a8c1998fdba92e9138559 (diff)
Factor out method to get pretty QML type name
Factor out the code to get the pretty QML type name for an QObject from ~QQmlInfo and put it into QQmlMetaType::prettyTypeName() method. Change-Id: I54ab0c49ba4a52074877447ef67708104f954f2d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/qqmlinfo.cpp')
-rw-r--r--src/qml/qml/qqmlinfo.cpp28
1 files changed, 1 insertions, 27 deletions
diff --git a/src/qml/qml/qqmlinfo.cpp b/src/qml/qml/qqmlinfo.cpp
index b9f96a724c..7a801032d3 100644
--- a/src/qml/qml/qqmlinfo.cpp
+++ b/src/qml/qml/qqmlinfo.cpp
@@ -109,34 +109,8 @@ QQmlInfo::~QQmlInfo()
if (object) {
engine = qmlEngine(d->object);
- QString typeName;
- QQmlType *type = QQmlMetaType::qmlType(object->metaObject());
- if (type) {
- typeName = type->qmlTypeName();
- int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
- if (lastSlash != -1)
- typeName = typeName.mid(lastSlash+1);
- } else {
- typeName = QString::fromUtf8(object->metaObject()->className());
- int marker = typeName.indexOf(QLatin1String("_QMLTYPE_"));
- if (marker != -1)
- typeName = typeName.left(marker);
-
- marker = typeName.indexOf(QLatin1String("_QML_"));
- if (marker != -1) {
- typeName = typeName.left(marker);
- typeName += QLatin1Char('*');
- type = QQmlMetaType::qmlType(QMetaType::type(typeName.toLatin1()));
- if (type) {
- typeName = type->qmlTypeName();
- int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
- if (lastSlash != -1)
- typeName = typeName.mid(lastSlash+1);
- }
- }
- }
- d->buffer.prepend(QLatin1String("QML ") + typeName + QLatin1String(": "));
+ d->buffer.prepend(QLatin1String("QML ") + QQmlMetaType::prettyTypeName(object) + QLatin1String(": "));
QQmlData *ddata = QQmlData::get(object, false);
if (ddata && ddata->outerContext) {