- fix: editors disappeared when close/close all
This commit is contained in:
parent
8e4c20a2a3
commit
f75c9f26cf
1
NEWS.md
1
NEWS.md
|
@ -22,6 +22,7 @@ Version 0.6.0
|
|||
- enhancement: show pinyin when input chinese characters
|
||||
- fix: add mutex lock to prevent rare conditions when editor is modifying and the content is read
|
||||
- fix: makefile generated for static / dynamic library projects not right
|
||||
- fix: editors disappeared when close/close all
|
||||
|
||||
Version 0.5.0
|
||||
- enhancement: support C++ using type alias;
|
||||
|
|
|
@ -86,10 +86,6 @@ Editor* EditorList::getEditor(int index, QTabWidget* tabsWidget) const {
|
|||
}
|
||||
|
||||
bool EditorList::closeEditor(Editor* editor, bool transferFocus, bool force) {
|
||||
beginUpdate();
|
||||
auto end = finally([this] {
|
||||
this->endUpdate();
|
||||
});
|
||||
if (editor == NULL)
|
||||
return false;
|
||||
if (force) {
|
||||
|
@ -97,7 +93,7 @@ bool EditorList::closeEditor(Editor* editor, bool transferFocus, bool force) {
|
|||
} else if ( (editor->modified()) && (!editor->empty())) {
|
||||
// ask user if he wants to save
|
||||
QMessageBox::StandardButton reply;
|
||||
reply = QMessageBox::question(pMainWindow,QObject::tr("Save"),
|
||||
reply = QMessageBox::question(editor,QObject::tr("Save"),
|
||||
QString(QObject::tr("Save changes to %1?")).arg(editor->filename()),
|
||||
QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);
|
||||
if (reply == QMessageBox::Cancel) {
|
||||
|
@ -109,6 +105,11 @@ bool EditorList::closeEditor(Editor* editor, bool transferFocus, bool force) {
|
|||
}
|
||||
}
|
||||
|
||||
beginUpdate();
|
||||
auto end = finally([this] {
|
||||
this->endUpdate();
|
||||
});
|
||||
|
||||
if (transferFocus && (editor->pageControl()->currentWidget()==editor)) {
|
||||
//todo: activate & focus the previous editor
|
||||
}
|
||||
|
@ -226,10 +227,10 @@ Editor *EditorList::operator[](int index)
|
|||
}
|
||||
|
||||
bool EditorList::closeAll(bool force) {
|
||||
beginUpdate();
|
||||
auto end = finally([this] {
|
||||
this->endUpdate();
|
||||
});
|
||||
// beginUpdate();
|
||||
// auto end = finally([this] {
|
||||
// this->endUpdate();
|
||||
// });
|
||||
while (mLeftPageWidget->count()>0) {
|
||||
if (!closeEditor(getEditor(0,mLeftPageWidget),false,force)) {
|
||||
return false;
|
||||
|
|
|
@ -2603,7 +2603,7 @@ void MainWindow::on_actionSave_triggered()
|
|||
if (editor->inProject() && (mProject))
|
||||
mProject->saveAll();
|
||||
} catch(FileError e) {
|
||||
QMessageBox::critical(this,tr("Error"),e.reason());
|
||||
QMessageBox::critical(editor,tr("Error"),e.reason());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2615,7 +2615,7 @@ void MainWindow::on_actionSaveAs_triggered()
|
|||
try {
|
||||
editor->saveAs();
|
||||
} catch(FileError e) {
|
||||
QMessageBox::critical(this,tr("Error"),e.reason());
|
||||
QMessageBox::critical(editor,tr("Error"),e.reason());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue