diff --git a/mainwindow.cpp b/mainwindow.cpp index ac0aa65..0b8060e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -25,9 +25,8 @@ MainWindow::MainWindow(QWidget *parent) : this, SLOT(closeFile())); connect(m_ui->actionExport, SIGNAL(activated()), this, SLOT(exportScene())); - connect(m_ui->actionQuit, SIGNAL(activated()), - QApplication::instance(), SLOT(quit())); + this, SLOT(quit())); connect(m_ui->actionAbout_QtMindMap, SIGNAL(activated()), this, SLOT(about())); @@ -209,6 +208,14 @@ void MainWindow::exportScene() } } +void MainWindow::quit() +{ + if (m_contentChanged && !closeFile()) + return; + + QApplication::instance()->quit(); +} + void MainWindow::keys() { QMessageBox msgBox(this); diff --git a/mainwindow.h b/mainwindow.h index d453aea..63adf7e 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -30,6 +30,7 @@ public slots: bool saveFileAs(); bool closeFile(); void exportScene(); + void quit(); void keys(); void about();