QML Inspector: Use lists of int as selections

The inspector service natively supports multi-selection. Instead of
converting between multi and single selection all the time, just use the
multi selections and only collapse to one row when interacting with the
view.

Change-Id: Ie969225f955c61b306cfbec4973ffc724ef1e224
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2018-11-15 16:42:25 +01:00
parent d29e7a0371
commit 2e6aa7a0ed
2 changed files with 38 additions and 53 deletions

View File

@@ -61,7 +61,7 @@ public:
void enableTools(bool enable);
private:
bool selectObjectInTree(int debugId);
void selectObjectsInTree(const QList<int> &debugIds);
void addObjectWatch(int objectDebugId);
void reloadEngines();
@@ -99,11 +99,8 @@ private:
void onReloaded();
void jumpToObjectDefinitionInEditor(const QmlDebug::FileReference &objSource);
enum SelectionTarget { NoTarget, ToolTarget, EditorTarget };
void selectObject(int debugId, const QmlDebug::FileReference &source,
SelectionTarget target);
void selectObjects(const QList<int> &debugIds, const QmlDebug::FileReference &source);
private:
QPointer<QmlEngine> m_qmlEngine;
QmlDebug::QmlEngineDebugClient *m_engineClient = nullptr;
QmlDebug::QmlToolsClient *m_toolsClient = nullptr;
@@ -111,8 +108,7 @@ private:
quint32 m_engineQueryId = 0;
quint32 m_rootContextQueryId = 0;
int m_objectToSelect = WatchItem::InvalidId;
int m_debugIdToSelect = WatchItem::InvalidId;
QList<int> m_objectsToSelect;
QList<quint32> m_objectTreeQueryIds;
QStack<QmlDebug::ObjectReference> m_objectStack;
@@ -124,8 +120,6 @@ private:
QList<int> m_fetchDataIds;
QTimer m_delayQueryTimer;
SelectionTarget m_targetToSync = NoTarget;
// toolbar
Core::Context m_inspectorToolsContext;
QAction *m_selectAction = nullptr;