diff --git a/src/plugins/qmljsinspector/qmljsclientproxy.cpp b/src/plugins/qmljsinspector/qmljsclientproxy.cpp index 5c8b3104a45..3ce7c69f747 100644 --- a/src/plugins/qmljsinspector/qmljsclientproxy.cpp +++ b/src/plugins/qmljsinspector/qmljsclientproxy.cpp @@ -35,6 +35,7 @@ #include "qmljsinspectorclient.h" #include "qmljsinspector.h" +#include #include #include #include @@ -174,13 +175,8 @@ void ClientProxy::onCurrentObjectsFetched(quint32 queryId, const QVariant &resul QmlDebugObjectReference obj = qvariant_cast(result); m_fetchCurrentObjects.push_front(obj); - //If this is not a root object, check if we have the parent - QmlDebugObjectReference parent = objectReferenceForId(obj.parentId()); - if (obj.parentId() != -1 && (parent.debugId() == -1 || parent.needsMoreData())) { - m_fetchCurrentObjectsQueryIds << fetchContextObject( - QmlDebugObjectReference(obj.parentId())); + if (!getObjectHierarchy(obj)) return; - } foreach (const QmlDebugObjectReference &o, m_fetchCurrentObjects) addObjectToTree(o); @@ -188,6 +184,23 @@ void ClientProxy::onCurrentObjectsFetched(quint32 queryId, const QVariant &resul m_fetchCurrentObjects.last()); } +bool ClientProxy::getObjectHierarchy(const QmlDebugObjectReference &obj) +{ + QmlDebugObjectReference parent = objectReferenceForId(obj.parentId()); + //for root object + if (obj.parentId() == -1) + return true; + + //for other objects + if (parent.debugId() == -1 || parent.needsMoreData()) { + m_fetchCurrentObjectsQueryIds << fetchContextObject( + QmlDebugObjectReference(obj.parentId())); + } else { + return getObjectHierarchy(parent); + } + return false; +} + void ClientProxy::setSelectedItemsByDebugId(const QList &debugIds) { if (!isConnected()) @@ -518,7 +531,14 @@ void ClientProxy::fetchContextObjectRecursive( m_objectTreeQueryIds.clear(); } foreach (const QmlDebugObjectReference & obj, context.objects()) { - quint32 queryId = fetchContextObject(obj); + quint32 queryId = 0; + using namespace QmlJsDebugClient::Constants; + if (m_engineClient->objectName() == QML_DEBUGGER && + m_engineClient->serviceVersion() >= CURRENT_SUPPORTED_VERSION) + queryId = fetchContextObject(obj); + else + queryId = m_engineClient->queryObjectRecursive(obj); + if (queryId) m_objectTreeQueryIds << queryId; } diff --git a/src/plugins/qmljsinspector/qmljsclientproxy.h b/src/plugins/qmljsinspector/qmljsclientproxy.h index bcdef3537bc..57d86c8edc5 100644 --- a/src/plugins/qmljsinspector/qmljsclientproxy.h +++ b/src/plugins/qmljsinspector/qmljsclientproxy.h @@ -158,6 +158,7 @@ private: void objectTreeFetched(quint32 queryId, const QVariant &result); void updateConnected(); void reloadEngines(); + bool getObjectHierarchy(const QmlDebugObjectReference &obj); QList objectReferences(const QmlDebugObjectReference &objectRef) const; QmlDebugObjectReference objectReferenceForId(int debugId, const QmlDebugObjectReference &ref) const;