Debugger: Add multi-engine support for QML inspector

The engines are listed as virtual root items for their contents. This
way, when we need an engineID we can walk up the tree of watch items and
the last valid one will be the engine.

Fixes: QTCREATORBUG-21486
Change-Id: Ib110457dc65523c1e2b75aa073f6cd399bbc9532
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2018-11-15 17:14:48 +01:00
parent 5170dd0858
commit eac0ab4974
4 changed files with 80 additions and 49 deletions

View File

@@ -54,11 +54,12 @@ class QmlInspectorAgent : public QObject
public:
QmlInspectorAgent(QmlEngine *engine, QmlDebug::QmlDebugConnection *connection);
quint32 queryExpressionResult(int debugId, const QString &expression);
quint32 queryExpressionResult(int debugId, const QString &expression, int engineId);
void assignValue(const WatchItem *data, const QString &expression, const QVariant &valueV);
void updateWatchData(const WatchItem &data);
void watchDataSelected(int id);
void enableTools(bool enable);
int engineId(const WatchItem *item) const;
private:
void selectObjectsInTree(const QList<int> &debugIds);
@@ -73,9 +74,9 @@ private:
void onValueChanged(int debugId, const QByteArray &propertyName, const QVariant &value);
void queryEngineContext();
void updateObjectTree(const QmlDebug::ContextReference &context);
void verifyAndInsertObjectInTree(const QmlDebug::ObjectReference &object);
void insertObjectInTree(const QmlDebug::ObjectReference &result);
void updateObjectTree(const QmlDebug::ContextReference &contexts, int engineId = -1);
void verifyAndInsertObjectInTree(const QmlDebug::ObjectReference &object, int engineId = -1);
void insertObjectInTree(const QmlDebug::ObjectReference &result, int engineId = -1);
void buildDebugIdHashRecursive(const QmlDebug::ObjectReference &ref);
void addWatchData(const QmlDebug::ObjectReference &obj,
@@ -106,13 +107,15 @@ private:
QmlDebug::QmlToolsClient *m_toolsClient = nullptr;
quint32 m_engineQueryId = 0;
quint32 m_rootContextQueryId = 0;
QList<quint32> m_rootContextQueryIds;
QHash<int, QmlDebug::ContextReference> m_rootContexts;
QList<int> m_objectsToSelect;
QList<quint32> m_objectTreeQueryIds;
QStack<QmlDebug::ObjectReference> m_objectStack;
QmlDebug::EngineReference m_engine;
QStack<QPair<QmlDebug::ObjectReference, int>> m_objectStack;
QList<QmlDebug::EngineReference> m_engines;
QHash<int, QString> m_debugIdToIname;
QHash<int, QmlDebug::FileReference> m_debugIdLocations;