forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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));
|
||||
|
@@ -105,7 +105,6 @@ private:
|
||||
void updateActionShortcuts();
|
||||
|
||||
void updateDocumentStatus(IDocument *document);
|
||||
void updateEditorListSelection(IEditor *newSelection);
|
||||
void fillListContextMenu(QMenu *menu);
|
||||
void updateToolBar(QWidget *toolBar);
|
||||
|
||||
|
Reference in New Issue
Block a user