now with window closing confirmation
This commit is contained in:
parent
63d1c4abdf
commit
1cc755d1ef
3 changed files with 357 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue