diff options
author | Bea Lam <bea.lam@nokia.com> | 2009-10-15 00:13:55 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2009-10-15 00:13:55 (GMT) |
commit | fb5d5ce1cd1e2714343c3e26338601aa5dd79a54 (patch) | |
tree | 535d19204e917e4ef82b8f11ce2e516828c62ea4 | |
parent | a02233bb18706569fb78ccfaa1f6c05d5523bc3d (diff) | |
download | Qt-fb5d5ce1cd1e2714343c3e26338601aa5dd79a54.zip Qt-fb5d5ce1cd1e2714343c3e26338601aa5dd79a54.tar.gz Qt-fb5d5ce1cd1e2714343c3e26338601aa5dd79a54.tar.bz2 |
Give more information about the value of a property when the variant
toString() is empty.
-rw-r--r-- | src/declarative/qml/qmlenginedebug.cpp | 12 | ||||
-rw-r--r-- | tools/qmldebugger/objectpropertiesview.cpp | 16 |
2 files changed, 22 insertions, 6 deletions
diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp index e20616a..1c7450a 100644 --- a/src/declarative/qml/qmlenginedebug.cpp +++ b/src/declarative/qml/qmlenginedebug.cpp @@ -318,7 +318,7 @@ void QmlEngineDebugServer::propertyChanged(int id, int objectId, const QByteArra QByteArray reply; QVariant v; QDataStream rs(&reply, QIODevice::WriteOnly); - + if (value.type() == QVariant::UserType || QmlMetaType::isObject(value.userType())) { QObject *o = QmlMetaType::toQObject(value); if (o) { @@ -327,9 +327,15 @@ void QmlEngineDebugServer::propertyChanged(int id, int objectId, const QByteArra objectName = QLatin1String("<unnamed>"); v = QString::fromUtf8(o->metaObject()->className()) + QLatin1String(": ") + objectName; + } else { + v = QString::fromUtf8(value.typeName()); + } + if (v.isNull()) { + QString s = value.toString(); + if (s.isEmpty()) + s = QLatin1String("<unknown>"); + v = s; } - if (v.isNull()) - v = value.toString(); } else { v = value; } diff --git a/tools/qmldebugger/objectpropertiesview.cpp b/tools/qmldebugger/objectpropertiesview.cpp index f725194..864468c 100644 --- a/tools/qmldebugger/objectpropertiesview.cpp +++ b/tools/qmldebugger/objectpropertiesview.cpp @@ -109,7 +109,7 @@ void ObjectPropertiesView::setObject(const QmlDebugObjectReference &object) item->setText(0, p.name()); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); if (!p.hasNotifySignal()) - item->setForeground(0, Qt::lightGray); + item->setForeground(0, Qt::gray); if (!p.binding().isEmpty()) { PropertiesViewItem *binding = new PropertiesViewItem(item); @@ -159,8 +159,18 @@ void ObjectPropertiesView::valueChanged(const QByteArray &name, const QVariant & { for (int i=0; i<m_tree->topLevelItemCount(); i++) { PropertiesViewItem *item = static_cast<PropertiesViewItem *>(m_tree->topLevelItem(i)); - if (item->property.name() == name) - item->setText(1, value.toString()); + if (item->property.name() == name) { + if (value.isNull()) { + item->setText(1, QLatin1String("null")); + item->setForeground(1, Qt::gray); + } else { + QString s = value.toString(); + if (s.isEmpty()) + s = QString::fromUtf8(value.typeName()); + item->setText(1, s); + item->setForeground(1, QBrush()); + } + } } } |