[PySide] QObject.destroyed() is not emitted

Alexey Vihorev vihorev at gmail.com
Thu Nov 29 18:53:20 CET 2012


Thanks! Now I've only got to wait until it's fixed :) 
BTW, a little off topic: what is PySide development status currently? Are there people paid to work on this, or it's purely community supported?

-----Original Message-----
From: Stephan Deibel [mailto:sdeibel at wingware.com] 
Sent: 29 ноября 2012 г. 19:38
To: Alexey Vihorev
Cc: 'Christian Tismer'; pyside at qt-project.org
Subject: Re: [PySide] QObject.destroyed() is not emitted

Alexey Vihorev wrote:
> Thanks, nice find, but... I hit the next hurdle trying to go this way. The signal QObject.destroyed(obj) is passing no arguments (probably because obj is already destroyed), so my static method has nothing to work on. Which kind of devaluates the whole idea, IMHO. And in PyQt4 it*does*  pass the object. Even more: in PyQt4 there is no need for static method approach, as it works perfectly with instance methods:

Yea, you would have to bind the necessary data to the callback like this:

   def on_destroy(val1=self.whatever, val2=self.something):
     print 'destroyed'
   self.destroyed.connect(on_destroy)

Whether this is possible or useful in your case is of course going to depend on the details of the code.

Having 'destroyed' be emitted before the object is destroyed and getting the object reference as an arg makes more sense to me.  That is what PyQt seems to do and it is what QObject does under Qt using C++, so I'd call this a bug in PySide.  I've added https://bugreports.qt-project.org/browse/PYSIDE-129

- Stephan




More information about the PySide mailing list