I have no means for a quick test at this moment, but try accepting the event.

Qt Code:
  1. void Dialog::closeEvent(QCloseEvent *e) {
  2. if (QMessageBox::question(this, tr("Close ALL windows?"),
  3. tr("Close ALL windows?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
  4. {
  5. qApp->closeAllWindows();
  6. e->accept();
  7. }
  8. }
To copy to clipboard, switch view to plain text mode