From c7458a52a95364f08142ace4c66b46032a218176 Mon Sep 17 00:00:00 2001 From: foniova Date: Sat, 21 Jan 2017 11:22:10 +0800 Subject: [PATCH] a bug when user click close button to close a document which is modified and not saved,there should be a messagebox asking whether to save or not save or cancel . if user choose cancel ,the document should not be close,but the TabBar remove the tab of the document. Signed-off-by: foniova --- tabbar.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tabbar.cpp b/tabbar.cpp index c4f4291..ea24c8c 100644 --- a/tabbar.cpp +++ b/tabbar.cpp @@ -136,8 +136,12 @@ void TabBar::closeTab(int index) if (index < 0 || index >= m_editors.size()) return; - Core::EditorManager::instance()->closeEditor(m_editors.takeAt(index)); - removeTab(index); + // error if user click close button to close a document which is modified and not saved, + // this call will defalt call closeEditor with closeEditor(IEditor *editor, bool askAboutModifiedEditors = true) + // if user chose "cancel", the Core::EditorManager won't close the editor, TabBar use takeAt will remove the editor from + // the container m_editors and call removeTab() to remove from QTabBar + Core::EditorManager::instance()->closeEditor(m_editors.value(index)); + } void TabBar::prevTabAction()