Qml Inspector: Don't ignore anonymous objects

Apparently the inspector service does not send a type string for all
objects. As the id string and the object name can also be empty, those
objects are anonymous then. Try to identify them by their source
location and if that doesn't work, just call them "<anonymous>".

Change-Id: I3bd3bad8b78c81ace95bfd7813cdd8bb0f5e14f2
Task-number: QTCREATORBUG-17741
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2017-03-14 19:00:36 +01:00
parent 323117a493
commit 1df4757dae

View File

@@ -606,7 +606,15 @@ void QmlInspectorAgent::addWatchData(const ObjectReference &obj,
name = obj.className(); name = obj.className();
if (name.isEmpty()) if (name.isEmpty())
return; name = obj.name();
if (name.isEmpty()) {
FileReference file = obj.source();
name = file.url().fileName() + ':' + QString::number(file.lineNumber());
}
if (name.isEmpty())
name = tr("<anonymous>");
// object // object
auto objWatch = new WatchItem; auto objWatch = new WatchItem;