[PyKDE] Deallocating multiple non-modal Dialogs from the same class

nahuel.greco at voiceovernet.com.ar nahuel.greco at voiceovernet.com.ar
Tue Jul 12 20:39:37 BST 2005

Hi, I have a problem. I have a python dialog class derived from
QDialog that must be instanced many times and be showed in a
non-modal way. I discovered that I need to set the parent of the
instances to the main window because if I set it to None the
dialog shows and returns inmediately from his exec_loop().

This is working ok, but the problem is that I think the instances are
never deallocated, so the application will leak memory. By what I know
about PyQT design, they aren't deallocated because a parent is set,
so they will be alive until the parent dies. But the parent in this
case is the application main window, and I can't set the parent to
None because the problem explained before. Also, I cant make the class
singleton because multiple instances of the dialog must be showed at
the same time with different data.

So, what I can do to instantiate multiple dialogs (at the same time)
from the main window _and_ then make sure that are deallocated?

Note, I exit from the dialogs with a done(x) triggered by a dialog
button clicked() signal.

(If somebody needs an example script in addition to this description
of the problem, please tell me and I will post it).

Nahuel Greco.

More information about the PyQt mailing list