Closing modal window programatically = STUCK (MacOSX + Qt5.4)
So I have some custom dialogs. They start life as a QWidget and have setWindowModality called on them.
The application does not run in the Qt event loop, instead calling processEvents & postEvents inside its own loop.
If you close the modal windows using the (x) close button in the title bar then everything works as expected except that you still cannot quit the application. But when closed by pressing the 'done' button (which implements a bunch of checks and stuff), the application becomes 'stuck' as though the model window is still open.
What actually needs to happen for the app to stop the modality? I'v tried calling close() on the window and not deleting the object, setting it non modal before closing it and some other ideas. But nothing works.
There may be a difference between using the 'X' vs a button signal (depends on which QDialog slot you use).
I usually implement QDialog::closeEvent(QEvent *event) so I can handle anything needed when closing the dialog from various options.
What slot do you attach to your 'done' button?
I'm not using any of the QDialog slots, the 'done' buttons' clicked slot is connected to a function which causes the event loop to process the data and close the dialog.
The reason the 'X' button isn't connected to anything is because I wasn't planning to show it. Just enabled it for debugging.
However even pressing the 'X' button still causes the app to get semi-stuck, since it beeps if you try to quit. Everything works correctly if the Dialog is not set modal.
I'm just really confused about what I'm doing wrong..