void MainWindow::closeEvent(QCloseEvent *event)
{
if (maybeSave()) {
writeSettings();
event->accept();
} else {
event->ignore();
}
}
- 不需要任何提示,可以直接忽略事件即可,如下:
void MainWindow::closeEvent(QCloseEvent *event)
{
event->ignore();
}