From: Rafał Długołęcki Date: Thu, 1 Aug 2013 22:54:01 +0000 (+0200) Subject: vlp-18 Fixed closing kernel with 'x' of window X-Git-Tag: 3.1~2 X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=refs%2Fheads%2Fvlp-18;p=vlp.git vlp-18 Fixed closing kernel with 'x' of window --- diff --git a/src/edit/editor.cpp b/src/edit/editor.cpp index 381de48..2e119de 100644 --- a/src/edit/editor.cpp +++ b/src/edit/editor.cpp @@ -25,7 +25,7 @@ #define TYPENUM 5 -Editor *e; +Editor *editor; /** * @attention Currently not in use @@ -68,7 +68,7 @@ void My_Edit::keyPressEvent(QKeyEvent *ev) * @copydoc QWidget::closeEvent(QCloseEvent*) */ void Editor::closeEvent(QCloseEvent * e) { - e->ignore(); + e->accept(); } /** @@ -670,14 +670,12 @@ void Editor::find_next() */ int main(int argc, char **argv) { - QApplication a(argc, argv); - //a.setStyle(WindowsStyle); - /* - Defaults are zeroed, so created Editor widget become top-level window. - */ - e = new Editor(argv[1]); - e->resize(600, 400); - e->show(); - return a.exec(); + QApplication app(argc, argv); + //app.setStyle(WindowsStyle); + editor = new Editor(argv[1]); + app.setMainWidget(editor); + editor->resize(600, 400); + editor->show(); + return app.exec(); } diff --git a/src/kernel/kernel.cpp b/src/kernel/kernel.cpp index b5e1cd1..333a555 100644 --- a/src/kernel/kernel.cpp +++ b/src/kernel/kernel.cpp @@ -217,11 +217,11 @@ private: /** * Event invoked on program close. - * @copydoc QWidget::closeEvent(QCloseEvent*) + * Closes application. Displays additional window to confirm exit. */ void QKernel::closeEvent(QCloseEvent * e) { - e->ignore(); + QuitProc(); } /** @@ -1517,5 +1517,6 @@ int main(int argc, char **argv) app->setMainWidget(&kernel); kernel.show(); kernel.InitMessage(); + return app->exec(); }