[PyQt] Closing QMainWindow with a bunch of child dialogs...

Dirk Wagener dwagen at stonethree.com
Tue Nov 27 11:18:23 GMT 2007


Hi

I have this situation:
I have a QMainWindow (parent) with a bunch of children dialogs.
One of the children is a dialog containing a QTabWidget with a bunch of 
QWidget tabs.

I now close the main window by clicking on the close button, which 
trigger a closeEvent().
In my closeEvent(self, event) method, I do the following:
* call accept() on the dialog containing the tab widget
* call accept() on all open dialogs
* call event.accept() on the close event received by this main window

My question is this:
What is the correct way to close a parent and all its children to ensure 
that
garbage collection happens properly?
I am confused about the use of accept(), close() or destroy() to get rid 
of dialogs.

Also, the dialog that contains a tab widget - should I close all the tab 
widgets (QWidgets)
and the QTabWidget when closing this dialog?

Kind regards
Dirk Wagener
-- 

Dirk Wagener <dwagen at stonethree.com>
(MSc. Electronic Engineering, Stell.)

Project Engineer
Stone Three Signal Processing (Pty.) Ltd.
http://www.stonethree.com
+27 21 851 3123 (phone)
+27 21 851 3127 (fax) 


We shall not cease from exploration and the end of all our exploring will
be to arrive where we started... and know the place for the first time.
T.S. Eliot



More information about the PyQt mailing list