[PyQt] QGraphicsItem problem - two instances and the same reference returned

Krystian Samp samp.krystian at gmail.com
Fri May 18 18:06:34 BST 2007


Actually the object has the same reference but it's a different object. The
same chunk of memory was allocated for the new instance - my mistake!
However, I still have the problem and now I think it has something to do
with signal - slot connections.

I create connection like this:
QtCore.QObject.connect(self.animation, QtCore.SIGNAL("finishedInit()"),

now, imagine that I created the instance of my class (which is 'self' in
above), I deleted it and created a new instance and apparently it was
assigned the same chunk of memory (if I print str(self) I see the same
output for the first and second instance). The object resides in the same
part of the memory but the two instances are different for sure (I assigned
a random number inside __init__ method and for the two instances it was
different). The connection created in above code works only with the first
instance, for the second one the method self._initAnimationFinished is not
invoked even though the finishedInit() signal is emitted by

Does anyone have any idea why? The only thing which comes to my mind is that
because self points to the same location the internal PyQt signal-slot
handling is confused (?). If I create several instances of this object in
order to get a different reference from the first instance than the whole
app works perfectly. Also everything works perfectly with old PyQt binding.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070518/265879fc/attachment-0001.html

More information about the PyQt mailing list