From b08e5a9bc3dd04e6630f43c459753731e87eda1a Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 19 Mar 2015 10:30:50 +0100 Subject: [PATCH] Debugger: Reduce QML engine <-> watch handler interaction Change-Id: Ia00f0747f40b18e99da2a7824d3e490291ab0b23 Reviewed-by: Christian Stenger --- .../debugger/qml/qmlinspectoragent.cpp | 37 ++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp index 4b1f557e107..778e691c79d 100644 --- a/src/plugins/debugger/qml/qmlinspectoragent.cpp +++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp @@ -784,33 +784,28 @@ void QmlInspectorAgent::addWatchData(const ObjectReference &obj, // properties if (append && obj.properties().count()) { - WatchData propertiesWatch; - propertiesWatch.id = objDebugId; - propertiesWatch.exp = ""; - propertiesWatch.name = tr("Properties"); - propertiesWatch.iname = objIname + ".[properties]"; - propertiesWatch.type = ""; - propertiesWatch.value = _("list"); - propertiesWatch.setHasChildren(true); - propertiesWatch.setAllUnneeded(); - - m_debuggerEngine->watchHandler()->insertData(propertiesWatch); + QByteArray iname = objIname + ".[properties]"; + auto propertiesWatch = new WatchItem(iname, tr("Properties")); + propertiesWatch->d.id = objDebugId; + propertiesWatch->d.value = _("list"); + propertiesWatch->d.setHasChildren(true); + propertiesWatch->d.setAllUnneeded(); foreach (const PropertyReference &property, obj.properties()) { const QString propertyName = property.name(); if (propertyName.isEmpty()) continue; - WatchData propertyWatch; - propertyWatch.id = objDebugId; - propertyWatch.exp = propertyName.toLatin1(); - propertyWatch.name = propertyName; - propertyWatch.iname = buildIName(propertiesWatch.iname, propertyName); - propertyWatch.type = property.valueTypeName().toLatin1(); - propertyWatch.value = property.value().toString(); - propertyWatch.setAllUnneeded(); - propertyWatch.setHasChildren(false); - m_debuggerEngine->watchHandler()->insertData(propertyWatch); + auto propertyWatch = new WatchItem(buildIName(iname, propertyName), propertyName); + propertyWatch->d.id = objDebugId; + propertyWatch->d.exp = propertyName.toLatin1(); + propertyWatch->d.type = property.valueTypeName().toLatin1(); + propertyWatch->d.value = property.value().toString(); + propertyWatch->d.setAllUnneeded(); + propertyWatch->d.setHasChildren(false); + propertiesWatch->appendChild(propertyWatch); } + + m_debuggerEngine->watchHandler()->insertItem(propertiesWatch); } // recurse