now with window closing confirmation

This commit is contained in:
R. Aidan Campbell 2018-04-28 16:21:30 -07:00
commit 1cc755d1ef
3 changed files with 357 additions and 0 deletions

View file

@ -8,6 +8,23 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this);
}
void MainWindow::closeEvent(QCloseEvent *event)
{
const QMessageBox::StandardButton ret
= QMessageBox::warning(this, tr("Application"),
tr("something-something-close?"),
QMessageBox::Yes | QMessageBox::No);
switch (ret) {
case QMessageBox::Yes:
event->accept();
break;
case QMessageBox::No:
default:
event->ignore();
break;
}
}
MainWindow::~MainWindow()
{
delete ui;