forked from qt-creator/qt-creator
QmlJSInspector: Query objects until root is parent
Change-Id: I239f028cbf450703cefd9dde584067ec1ce8032c Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
#include "qmljsinspectorclient.h"
|
#include "qmljsinspectorclient.h"
|
||||||
#include "qmljsinspector.h"
|
#include "qmljsinspector.h"
|
||||||
|
|
||||||
|
#include <qmljsdebugclient/qmljsdebugclientconstants.h>
|
||||||
#include <debugger/debuggerplugin.h>
|
#include <debugger/debuggerplugin.h>
|
||||||
#include <debugger/debuggerrunner.h>
|
#include <debugger/debuggerrunner.h>
|
||||||
#include <debugger/qml/qmlengine.h>
|
#include <debugger/qml/qmlengine.h>
|
||||||
@@ -174,13 +175,8 @@ void ClientProxy::onCurrentObjectsFetched(quint32 queryId, const QVariant &resul
|
|||||||
QmlDebugObjectReference obj = qvariant_cast<QmlDebugObjectReference>(result);
|
QmlDebugObjectReference obj = qvariant_cast<QmlDebugObjectReference>(result);
|
||||||
m_fetchCurrentObjects.push_front(obj);
|
m_fetchCurrentObjects.push_front(obj);
|
||||||
|
|
||||||
//If this is not a root object, check if we have the parent
|
if (!getObjectHierarchy(obj))
|
||||||
QmlDebugObjectReference parent = objectReferenceForId(obj.parentId());
|
|
||||||
if (obj.parentId() != -1 && (parent.debugId() == -1 || parent.needsMoreData())) {
|
|
||||||
m_fetchCurrentObjectsQueryIds << fetchContextObject(
|
|
||||||
QmlDebugObjectReference(obj.parentId()));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
foreach (const QmlDebugObjectReference &o, m_fetchCurrentObjects)
|
foreach (const QmlDebugObjectReference &o, m_fetchCurrentObjects)
|
||||||
addObjectToTree(o);
|
addObjectToTree(o);
|
||||||
@@ -188,6 +184,23 @@ void ClientProxy::onCurrentObjectsFetched(quint32 queryId, const QVariant &resul
|
|||||||
m_fetchCurrentObjects.last());
|
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<int> &debugIds)
|
void ClientProxy::setSelectedItemsByDebugId(const QList<int> &debugIds)
|
||||||
{
|
{
|
||||||
if (!isConnected())
|
if (!isConnected())
|
||||||
@@ -518,7 +531,14 @@ void ClientProxy::fetchContextObjectRecursive(
|
|||||||
m_objectTreeQueryIds.clear();
|
m_objectTreeQueryIds.clear();
|
||||||
}
|
}
|
||||||
foreach (const QmlDebugObjectReference & obj, context.objects()) {
|
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)
|
if (queryId)
|
||||||
m_objectTreeQueryIds << queryId;
|
m_objectTreeQueryIds << queryId;
|
||||||
}
|
}
|
||||||
|
@@ -158,6 +158,7 @@ private:
|
|||||||
void objectTreeFetched(quint32 queryId, const QVariant &result);
|
void objectTreeFetched(quint32 queryId, const QVariant &result);
|
||||||
void updateConnected();
|
void updateConnected();
|
||||||
void reloadEngines();
|
void reloadEngines();
|
||||||
|
bool getObjectHierarchy(const QmlDebugObjectReference &obj);
|
||||||
|
|
||||||
QList<QmlDebugObjectReference> objectReferences(const QmlDebugObjectReference &objectRef) const;
|
QList<QmlDebugObjectReference> objectReferences(const QmlDebugObjectReference &objectRef) const;
|
||||||
QmlDebugObjectReference objectReferenceForId(int debugId, const QmlDebugObjectReference &ref) const;
|
QmlDebugObjectReference objectReferenceForId(int debugId, const QmlDebugObjectReference &ref) const;
|
||||||
|
Reference in New Issue
Block a user