Commit c33348a4 authored by Kai Koehne's avatar Kai Koehne
Browse files

Observer mode: Fix automatic selection of all instances

If the user clicks on an instance of an element in the running app
while in server mode, the cursor selection is automatically updated.
However, the change of the cursor then leads to all the other
instances of the element at the cursor position being selected too.

Prevent this 'call back' in the QmlInspector by checking whether one
of the newly selected items is the one just selected.

Simpler mechanisms (like a sequential blocking of updates) don't
work because the call back happens through a QTimer.

Task-number: QTCREATORBUG-2366
parent 7e50ebcf
......@@ -138,6 +138,7 @@ InspectorUi::InspectorUi(QObject *parent)
, m_clientProxy(0)
, m_qmlEngine(0)
, m_debugQuery(0)
, m_lastSelectedDebugId(-1)
, m_debugProject(0)
m_instance = this;
......@@ -350,6 +351,18 @@ void InspectorUi::updateEngineList()
void InspectorUi::changeSelectedItems(const QList<QDeclarativeDebugObjectReference> &objects)
if (m_lastSelectedDebugId >= 0) {
foreach (QDeclarativeDebugObjectReference ref, objects) {
if (ref.debugId() == m_lastSelectedDebugId) {
// this is only the 'call back' after we have programatically set a new cursor
// position in
m_lastSelectedDebugId = -1;
m_lastSelectedDebugId = -1;
......@@ -548,6 +561,8 @@ void InspectorUi::gotoObjectReferenceDefinition(const QDeclarativeDebugObjectRef
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor);
if (textEditor) {
m_lastSelectedDebugId = obj.debugId();
......@@ -162,6 +162,7 @@ private:
ClientProxy *m_clientProxy;
Debugger::QmlEngine *m_qmlEngine;
QDeclarativeDebugExpressionQuery *m_debugQuery;
int m_lastSelectedDebugId;
// Qml/JS integration
QHash<QString, QmlJSLiveTextPreview *> m_textPreviews;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment