forked from qt-creator/qt-creator
Editors: Get rid of keeping separate lists of "duplicated" editors.
And use documents for the list of currently open documents, instead of using a set of "original" editors that needed to be separately managed. Change-Id: I3379ca44f03646399d3ecb0e775d7f1fd81a6bcf Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -290,7 +290,8 @@ void EditorToolBar::setToolbarCreationFlags(ToolbarCreationFlags flags)
|
||||
|
||||
void EditorToolBar::setCurrentEditor(IEditor *editor)
|
||||
{
|
||||
d->m_editorList->setCurrentIndex(d->m_editorsListModel->rowOfEditor(editor));
|
||||
IDocument *document = editor ? editor->document() : 0;
|
||||
d->m_editorList->setCurrentIndex(d->m_editorsListModel->rowOfDocument(document));
|
||||
|
||||
// If we never added the toolbar from the editor, we will never change
|
||||
// the editor, so there's no need to update the toolbar either.
|
||||
@@ -303,7 +304,7 @@ void EditorToolBar::setCurrentEditor(IEditor *editor)
|
||||
void EditorToolBar::updateEditorListSelection(IEditor *newSelection)
|
||||
{
|
||||
if (newSelection)
|
||||
d->m_editorList->setCurrentIndex(d->m_editorsListModel->rowOfEditor(newSelection));
|
||||
d->m_editorList->setCurrentIndex(d->m_editorsListModel->rowOfDocument(newSelection->document()));
|
||||
}
|
||||
|
||||
void EditorToolBar::changeActiveEditor(int row)
|
||||
@@ -375,7 +376,7 @@ void EditorToolBar::updateEditorStatus(IEditor *editor)
|
||||
return;
|
||||
}
|
||||
|
||||
d->m_editorList->setCurrentIndex(d->m_editorsListModel->rowOfEditor(editor));
|
||||
d->m_editorList->setCurrentIndex(d->m_editorsListModel->rowOfDocument(editor->document()));
|
||||
|
||||
if (editor->document()->filePath().isEmpty()) {
|
||||
d->m_lockButton->setIcon(QIcon());
|
||||
|
||||
Reference in New Issue
Block a user