I have one main Window and one non-modal Dialog. I suppose non-modal dialog should close itself when I close main window. Instead if I open non-modal dialog, I should close manually both of them - if I close main window, non-modal dialog will remain, and I need to close it manually.
# App and main window
app = QtGui.QApplication(sys.argv)
window = Window()
window.show()
sys.exit(app.exec_())
class Window ... :
...
def func:
non_modal_dialog = NonModalDialog()
non_modal_dialog.show()
...
What should I do so when I close main window all non-modal dialogs will be closed automatically?
Thank you.
Have you made the dialog's parent widget the main window or at least some sort of descendant of the main window? If you do that then the dialog will go away when the window does. I'm familiar with Qt but not Python but it didn't look like that's the case from your code sample.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With