[PyKDE] Re: Signal destroyed() not emitted for QWidget
Phil Thompson
phil at riverbankcomputing.co.uk
Tue Feb 14 16:41:17 GMT 2006
On Tuesday 14 February 2006 4:28 pm, Giovanni Bajo wrote:
> Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
> > I think this is the way Qt works when the receiver is a child of the
>
> sender.
>
> > When PyQt3 makes a connection to a Python callable it creates a proxy
> > QObject that is actually connected to the sender. To make sure the proxy
> > doesn't leak memory it is made a child of the sender.
> >
> > If I write a C++ program similar to your test where the receiver is a
>
> child
>
> > of the sender then it behaves in the same way.
> >
> > If I modify the C++ program so that the receiver is not a child of the
> > sender, but instead also connects to the sender's destroyed() signal so
> > that it can call deleteLater() on itself - then it seems to behave as you
> > were expecting.
> >
> > I'll probably make a change in the next snapshot or so.
>
> Thanks. But why does it work for QObject and not for QWidget?
I don't know - you'll have to read the code of the QObject dtor. I'm just
happy that C++ demonstrates the same behaviour.
Phil
More information about the PyQt
mailing list