I have a modeless dialog that overrides closeEvent() in order to save its state. This works fine if I actually close the dialog. However, if I just exit the application by whatever means (which of course results in my dialog closing), closeEvent() never gets called.
Is this by design? Is it a Qt bug? Is there something like a property I need to set on the widget to tell it to receive close events when the application is shutting down?
I guess I can duplicate the “save state” code in the dialog’s destructor, but it would be nicer if I didn’t have to.
Thanks for any thoughts!
There’s a bug in Qt that when an application quits via menu command (instead of closing the last
QMainWindow), the event system is not properly shutdown and objects on the heap are just leaked. It basically just callsexit();right away.I filed a bug for this on the Mac platform. I don’t know what your platform is and if it’s also affected.