Modal dialog prevent the calling of closeEvent of the mainWindow
-
Hi,
I noticed that the closeEvent which I use to commit some changes and do some clean-up just before shutting down my application, is NOT called while the user kill the process and a modal dialog is shown in the mainWindow (as the parent or not). If the dialog is modeless the closeEvent is called.
Any suggestions, and thanks for your help! -
@SamurayH said in Modal dialog prevent the calling of closeEvent of the mainWindow:
kill the process
How does the user kill the process? How can you get a close event at all if you kill the process? Why would you want to commit anything if the process gets killed (at the very most clean up, that should be it)?
-
I can get the closeEvent if the process is killed in the task manager and no modeless dialog is shown. I can't leave without that clean up. I managed right now to disable the window while showing the modeless dialog but it doesn't seem to be a good alternative.
-
@SamurayH said in Modal dialog prevent the calling of closeEvent of the mainWindow:
can get the closeEvent if the process is killed in the task manager
I'm astonished at that. It's probably not very cross-platform, which maybe you don't care about.
I would never rely on any kind of OS "kill signal" invoking anything like a close event on any widget in your code. And you've seen it isn't reliable if, say, you have some modal dialog up anyway. The correct way is surely to handle the "kill" signal from the OS explicitly via code, and have that share any "clean up" code you may have written for the close event via direct function call without relying on the event itself.