Check button press of QMessageBox
-
Is it possible to check if the button from the messagebox was pressed?
QMessageBox::warning(this,
tr("Some Header Text"),
tr("Some Text"),
QMessageBox::Save);I would like to check if the save button was pressed. The application exists on the normal use of QMessageBox as this closes the latest window.
-
The application exists [sic., should be exits] on the normal use of QMessageBox as this closes the latest window.
closes the latest opened window and that closes my appYou really cannot carry on with code like this. Running a
QMessageBox
and the user closing it should not close your application. You must stop and re-architect your code to deal with that first. Otherwise you won't be able to implement perfectly normal solutions like @qt-1234 has given.EDIT For that, go back to your original thread on this, https://forum.qt.io/topic/108636/qt-app-doesn-t-close-properly-still-visible-in-task-manager, I'm posting a brief reply there now
-
Hi
Why should exec() close the app?You might run into this
https://doc.qt.io/qt-5/qguiapplication.html#quitOnLastWindowClosed-propthis is true pr default so if it thinks you closed the last top window, it will
quit the app.so for test, try setting it to false and see if it still closes whole app.
It the norm to use exec() to show dialogs as to have them as modal so you really should find out why it closes the app if you use it.
Bug or just the bool flag.