From 5eb0e1cbd77e91d27ccfcb3ce897d1b45481bb5f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20D=C5=82ugo=C5=82=C4=99cki?= Date: Fri, 2 Aug 2013 00:54:01 +0200 Subject: [PATCH] vlp-18 Fixed closing kernel with 'x' of window --- src/edit/editor.cpp | 20 +++++++++----------- src/kernel/kernel.cpp | 5 +++-- 2 files changed, 12 insertions(+), 13 deletions(-) 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(); } -- 2.30.2