Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top