summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2019-06-17 12:04:47 +0200
committerEike Ziller <eike.ziller@qt.io>2019-06-18 07:38:22 +0000
commit7d46060af011737caa2f673d601898abcd3a4e48 (patch)
treeec4d41970f08a7933deabeb46239523476487386
parente8705deb1c038d79a47e84274b4c3fdc6d2275aa (diff)
downloadqt-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>
-rw-r--r--src/plugins/coreplugin/editortoolbar.cpp15
-rw-r--r--src/plugins/coreplugin/editortoolbar.h1
2 files changed, 4 insertions, 12 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));
diff --git a/src/plugins/coreplugin/editortoolbar.h b/src/plugins/coreplugin/editortoolbar.h
index b8d7fad468..0d82e58303 100644
--- a/src/plugins/coreplugin/editortoolbar.h
+++ b/src/plugins/coreplugin/editortoolbar.h
@@ -105,7 +105,6 @@ private:
void updateActionShortcuts();
void updateDocumentStatus(IDocument *document);
- void updateEditorListSelection(IEditor *newSelection);
void fillListContextMenu(QMenu *menu);
void updateToolBar(QWidget *toolBar);