Debugger: Reduce QML engine <-> watch handler interaction

Change-Id: Ia00f0747f40b18e99da2a7824d3e490291ab0b23
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-03-19 10:30:50 +01:00
parent 15f1ca9028
commit b08e5a9bc3

View File

@@ -784,33 +784,28 @@ void QmlInspectorAgent::addWatchData(const ObjectReference &obj,
// properties // properties
if (append && obj.properties().count()) { if (append && obj.properties().count()) {
WatchData propertiesWatch; QByteArray iname = objIname + ".[properties]";
propertiesWatch.id = objDebugId; auto propertiesWatch = new WatchItem(iname, tr("Properties"));
propertiesWatch.exp = ""; propertiesWatch->d.id = objDebugId;
propertiesWatch.name = tr("Properties"); propertiesWatch->d.value = _("list");
propertiesWatch.iname = objIname + ".[properties]"; propertiesWatch->d.setHasChildren(true);
propertiesWatch.type = ""; propertiesWatch->d.setAllUnneeded();
propertiesWatch.value = _("list");
propertiesWatch.setHasChildren(true);
propertiesWatch.setAllUnneeded();
m_debuggerEngine->watchHandler()->insertData(propertiesWatch);
foreach (const PropertyReference &property, obj.properties()) { foreach (const PropertyReference &property, obj.properties()) {
const QString propertyName = property.name(); const QString propertyName = property.name();
if (propertyName.isEmpty()) if (propertyName.isEmpty())
continue; continue;
WatchData propertyWatch; auto propertyWatch = new WatchItem(buildIName(iname, propertyName), propertyName);
propertyWatch.id = objDebugId; propertyWatch->d.id = objDebugId;
propertyWatch.exp = propertyName.toLatin1(); propertyWatch->d.exp = propertyName.toLatin1();
propertyWatch.name = propertyName; propertyWatch->d.type = property.valueTypeName().toLatin1();
propertyWatch.iname = buildIName(propertiesWatch.iname, propertyName); propertyWatch->d.value = property.value().toString();
propertyWatch.type = property.valueTypeName().toLatin1(); propertyWatch->d.setAllUnneeded();
propertyWatch.value = property.value().toString(); propertyWatch->d.setHasChildren(false);
propertyWatch.setAllUnneeded(); propertiesWatch->appendChild(propertyWatch);
propertyWatch.setHasChildren(false);
m_debuggerEngine->watchHandler()->insertData(propertyWatch);
} }
m_debuggerEngine->watchHandler()->insertItem(propertiesWatch);
} }
// recurse // recurse