diff --git a/src/plugins/qmljsinspector/qmljsclientproxy.cpp b/src/plugins/qmljsinspector/qmljsclientproxy.cpp index 6dbecc62bcb..f72996470de 100644 --- a/src/plugins/qmljsinspector/qmljsclientproxy.cpp +++ b/src/plugins/qmljsinspector/qmljsclientproxy.cpp @@ -279,33 +279,37 @@ void ClientProxy::queryEngineContext(int id) void ClientProxy::contextChanged() { if (m_contextQuery) { - m_rootObjects = m_contextQuery->rootContext().objects(); + m_rootObjects.clear(); + QDeclarativeDebugContextReference rootContext = m_contextQuery->rootContext(); delete m_contextQuery; m_contextQuery = 0; - if (m_rootObjects.isEmpty()) { - emit objectTreeUpdated(); - return; - } - qDeleteAll(m_objectTreeQuery); m_objectTreeQuery.clear(); - foreach(const QDeclarativeDebugObjectReference & obj, m_rootObjects) { - QDeclarativeDebugObjectQuery* query = m_client->queryObjectRecursive(obj, this); - if (!query->isWaiting()) { - query->deleteLater(); //ignore errors; - } else { - m_objectTreeQuery << query; - connect(query, - SIGNAL(stateChanged(QDeclarativeDebugQuery::State)), - SLOT(objectTreeFetched(QDeclarativeDebugQuery::State))); - } + fetchContextObjectRecusrsive(rootContext); + } +} + +void ClientProxy::fetchContextObjectRecusrsive(const QDeclarativeDebugContextReference& context) +{ + foreach (const QDeclarativeDebugObjectReference & obj, context.objects()) { + QDeclarativeDebugObjectQuery* query = m_client->queryObjectRecursive(obj, this); + if (!query->isWaiting()) { + query->deleteLater(); //ignore errors; + } else { + m_objectTreeQuery << query; + connect(query, + SIGNAL(stateChanged(QDeclarativeDebugQuery::State)), + SLOT(objectTreeFetched(QDeclarativeDebugQuery::State))); } } - + foreach (const QDeclarativeDebugContextReference& child, context.contexts()) { + fetchContextObjectRecusrsive(child); + } } + void ClientProxy::objectTreeFetched(QDeclarativeDebugQuery::State state) { QDeclarativeDebugObjectQuery *query = qobject_cast(sender()); diff --git a/src/plugins/qmljsinspector/qmljsclientproxy.h b/src/plugins/qmljsinspector/qmljsclientproxy.h index 2426e6853a8..fcc30eafb1f 100644 --- a/src/plugins/qmljsinspector/qmljsclientproxy.h +++ b/src/plugins/qmljsinspector/qmljsclientproxy.h @@ -124,6 +124,7 @@ private slots: void onCurrentObjectsChanged(const QList &debugIds, bool requestIfNeeded = true); void updateEngineList(); void objectTreeFetched(QDeclarativeDebugQuery::State state = QDeclarativeDebugQuery::Completed); + void fetchContextObjectRecusrsive(const QmlJsDebugClient::QDeclarativeDebugContextReference& context); private: bool isDesignClientConnected() const;