diff options
author | Eike Ziller <eike.ziller@nokia.com> | 2012-05-15 17:57:01 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@nokia.com> | 2012-05-21 08:57:20 +0200 |
commit | f1c77a8349424344b0447067a957f45fc9c50d95 (patch) | |
tree | 04c7f308dcd41b439cbee11b9d25a4d7eb1cb93a /src/plugins | |
parent | a788bf97f81c09c814159d228f387bb99db61b1c (diff) | |
download | qt-creator-f1c77a8349424344b0447067a957f45fc9c50d95.tar.gz |
Fix closing document when split and two documents are open.
If one had two documents open, but the same document visible in both
split views, closing the document would lead to an empty view and
strange behavior of the close button while in that state.
Task-number: QTCREATORBUG-7361
Change-Id: I3c0673a82b9d11700326a946a04984a2d6d58fe8
Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/coreplugin/editormanager/editormanager.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index d9ab7b9ef2..8f5f8619dc 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -883,8 +883,10 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask return false; // add duplicates + QList<IEditor *> duplicates; foreach(IEditor *editor, acceptedEditors) - acceptedEditors += d->m_editorModel->duplicatesFor(editor); + duplicates += d->m_editorModel->duplicatesFor(editor); + acceptedEditors += duplicates; QList<EditorView*> closedViews; @@ -914,8 +916,13 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask activateEditor(view, newCurrent, NoActivate); } else { QModelIndex idx = d->m_editorModel->firstRestoredEditor(); - if (idx.isValid()) + if (idx.isValid()) { activateEditorForIndex(view, idx, NoActivate); + } else { + const QList<IEditor *> editors = d->m_editorModel->editors(); + if (!editors.isEmpty()) + activateEditor(view, editors.last(), NoActivate); + } } } |