Commit 8e1815dc authored by Aurindam Jana's avatar Aurindam Jana

Inspector: Disable object selection from Editor

Clicking around QML code in the editor would update
the Inspector. This is now disabled.

The problem with the behaviour is that the object tree
would be expanded and that may be unwelcome for some users.
Also some code snippets may be shared by multiple
objects, for eg. a custom QML component. In this case, the
behaviour was undefined as to which object in the tree would
be selected. This case of 'one-to-many' was not handled. Finally,
the inspector queries for object ids lazily. Hence, sections of
code may not be associated with an id resulting in unknown
behaviour.

Task-number: QTCREATORBUG-8246

Change-Id: I6266fd0767d0619af70387e2e867a756548120ca
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent f049c58c
......@@ -71,8 +71,6 @@ QmlInspectorAdapter::QmlInspectorAdapter(QmlAdapter *debugAdapter,
, m_debugIdToSelect(-1)
, m_currentSelectedDebugId(-1)
, m_listeningToEditorManager(false)
, m_selectionCallbackExpected(false)
, m_cursorPositionChangedExternally(false)
, m_toolsClientConnected(false)
, m_inspectorToolsContext("Debugger.QmlInspector")
, m_selectAction(new QAction(this))
......@@ -263,18 +261,6 @@ void QmlInspectorAdapter::engineClientStatusChanged(QmlDebug::ClientStatus statu
}
}
void QmlInspectorAdapter::selectObjectsFromEditor(const QList<int> &debugIds)
{
if (m_selectionCallbackExpected) {
m_selectionCallbackExpected = false;
return;
}
m_cursorPositionChangedExternally = true;
m_targetToSync = ToolTarget;
m_debugIdToSelect = debugIds.first();
selectObject(agent()->objectForId(m_debugIdToSelect), ToolTarget);
}
void QmlInspectorAdapter::selectObjectsFromToolsClient(const QList<int> &debugIds)
{
if (debugIds.isEmpty())
......@@ -327,9 +313,6 @@ void QmlInspectorAdapter::createPreviewForEditor(Core::IEditor *newEditor)
} else {
QmlLiveTextPreview *preview
= new QmlLiveTextPreview(doc, initdoc, this, this);
connect(preview,
SIGNAL(selectedItemsChanged(QList<int>)),
SLOT(selectObjectsFromEditor(QList<int>)));
preview->setApplyChangesToQmlInspector(
debuggerCore()->action(QmlUpdateOnSave)->isChecked());
......@@ -472,24 +455,14 @@ void QmlInspectorAdapter::showConnectionStatusMessage(const QString &message)
void QmlInspectorAdapter::jumpToObjectDefinitionInEditor(
const FileReference &objSource)
{
if (m_cursorPositionChangedExternally) {
m_cursorPositionChangedExternally = false;
return;
}
const QString fileName = m_engine->toFileInProject(objSource.url());
Core::EditorManager *editorManager = Core::EditorManager::instance();
Core::IEditor *currentEditor = editorManager->currentEditor();
Core::IEditor *editor = editorManager->openEditor(fileName);
TextEditor::ITextEditor *textEditor
= qobject_cast<TextEditor::ITextEditor*>(editor);
if (currentEditor != editor)
m_selectionCallbackExpected = true;
if (textEditor) {
m_selectionCallbackExpected = true;
editorManager->addCurrentPositionToNavigationHistory();
textEditor->gotoLine(objSource.lineNumber());
textEditor->widget()->setFocus();
......
......@@ -82,7 +82,6 @@ private slots:
void toolsClientStatusChanged(QmlDebug::ClientStatus status);
void engineClientStatusChanged(QmlDebug::ClientStatus status);
void selectObjectsFromEditor(const QList<int> &debugIds);
void selectObjectsFromToolsClient(const QList<int> &debugIds);
void onObjectFetched(const QmlDebug::ObjectReference &ref);
......@@ -130,8 +129,6 @@ private:
QHash<QString, QmlLiveTextPreview *> m_textPreviews;
QmlJS::Snapshot m_loadedSnapshot; //the snapshot loaded by the viewer
QStringList m_pendingPreviewDocumentNames;
bool m_selectionCallbackExpected;
bool m_cursorPositionChangedExternally;
// toolbar
bool m_toolsClientConnected;
......
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