Confirm with the user before exiting the runtime. Fixes #2443

This commit is contained in:
Neel Patel 2017-11-07 20:10:55 -05:00 committed by Dave Page
parent 8b543a58fe
commit 8a4b2ea953

View File

@ -174,13 +174,20 @@ BrowserWindow::~BrowserWindow()
// Save the window geometry on close
void BrowserWindow::closeEvent(QCloseEvent *event)
{
QSettings settings;
settings.setValue("Browser/Geometry", saveGeometry());
settings.setValue("Browser/WindowState", saveState());
QMainWindow::closeEvent(event);
if (QMessageBox::Yes == QMessageBox::question(this, "Exit the application?", "Are you sure you want to exit the application?", QMessageBox::Yes | QMessageBox::No))
{
QSettings settings;
settings.setValue("Browser/Geometry", saveGeometry());
settings.setValue("Browser/WindowState", saveState());
QMainWindow::closeEvent(event);
event->accept();
}
else
{
event->ignore();
}
}
// Create the actions for the window
void BrowserWindow::createActions()
{