Fix soft assert when opening widget designer form

Creating a designer form adds it to design mode's editor tool bar, which
is correct. But this should not try to switch the drop down to this new
document, which has only just been created and is not registered
anywhere. It is not even officially the current document yet. Switching
the drop down is done when it becomes the current document anyhow.

Change-Id: If7fa8273600d83eda2cd1fa4731924007f8ca1f5
Fixes: QTCREATORBUG-20270
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Eike Ziller
2019-03-06 08:53:56 +01:00
parent 4e8a3678d5
commit 7a0ee1009b

View File

@@ -272,8 +272,6 @@ void EditorToolBar::addEditor(IEditor *editor)
if (toolBar && !d->m_isStandalone) if (toolBar && !d->m_isStandalone)
addCenterToolBar(toolBar); addCenterToolBar(toolBar);
updateDocumentStatus(editor->document());
} }
void EditorToolBar::addCenterToolBar(QWidget *toolBar) void EditorToolBar::addCenterToolBar(QWidget *toolBar)
@@ -408,10 +406,6 @@ void EditorToolBar::updateDocumentStatus(IDocument *document)
return; return;
} }
const Utils::optional<int> index = DocumentModel::rowOfDocument(document);
if (QTC_GUARD(index))
d->m_editorList->setCurrentIndex(*index);
if (document->filePath().isEmpty()) { if (document->filePath().isEmpty()) {
d->m_lockButton->setIcon(QIcon()); d->m_lockButton->setIcon(QIcon());
d->m_lockButton->setEnabled(false); d->m_lockButton->setEnabled(false);