diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-06-17 12:04:47 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2019-06-18 07:38:22 +0000 |
commit | 7d46060af011737caa2f673d601898abcd3a4e48 (patch) | |
tree | ec4d41970f08a7933deabeb46239523476487386 /src/plugins/coreplugin/editortoolbar.cpp | |
parent | e8705deb1c038d79a47e84274b4c3fdc6d2275aa (diff) | |
download | qt-creator-7d46060af011737caa2f673d601898abcd3a4e48.tar.gz |
Fix disabled close button in designer editor tool bar
It was never actually updating when switching the editor.
An update was just accidentally triggered when the designer plugin
updated the editor XML when switching modes, which triggered
an intermediate document change signal.
Get rid of the separate code paths for setting the current editor
for "standalone" editor tool bars and the tool bars in editor views,
which implicitly corrects the update behavior in the former case.
Fixes: QTCREATORBUG-22553
Change-Id: Ieb9f4b53600e1e1b66695ec86164628025df73f8
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/coreplugin/editortoolbar.cpp')
-rw-r--r-- | src/plugins/coreplugin/editortoolbar.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp index 28ed8a9acc..c23aaa49d2 100644 --- a/src/plugins/coreplugin/editortoolbar.cpp +++ b/src/plugins/coreplugin/editortoolbar.cpp @@ -298,8 +298,10 @@ void EditorToolBar::setToolbarCreationFlags(ToolbarCreationFlags flags) { d->m_isStandalone = flags & FlagsStandalone; if (d->m_isStandalone) { - connect(EditorManager::instance(), &EditorManager::currentEditorChanged, - this, &EditorToolBar::updateEditorListSelection); + connect(EditorManager::instance(), + &EditorManager::currentEditorChanged, + this, + &EditorToolBar::setCurrentEditor); disconnect(d->m_editorList, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &EditorToolBar::listSelectionActivated); @@ -330,15 +332,6 @@ void EditorToolBar::setCurrentEditor(IEditor *editor) updateDocumentStatus(document); } -void EditorToolBar::updateEditorListSelection(IEditor *newSelection) -{ - if (newSelection) { - const Utils::optional<int> index = DocumentModel::rowOfDocument(newSelection->document()); - if (QTC_GUARD(index)) - d->m_editorList->setCurrentIndex(index.value()); - } -} - void EditorToolBar::changeActiveEditor(int row) { EditorManager::activateEditorForEntry(DocumentModel::entryAtRow(row)); |