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

Krystian Samp samp.krystian at gmail.com
Fri May 18 00:31:52 BST 2007


Hi,
I'm using the newest version of Qt and PyQt. I have my own subclass of
QGraphicsItem and it happens that I get the same reference when creating two
instances.

I suppose the subclass is implemented properly, here is the beginning which
is the most crucial part:
class Circle(QtGui.QGraphicsItem):
    def __init__(self, radius, items, parent):
        QtGui.QGraphicsItem.__init__(self, parent)

It seems that I get the reference to the same object. I check It with
print('circle '+str(circle)):

new circle <items.Circle object at 0x00C0CF18>
circle shutdown <items.Circle object at 0x00C0CF18>
new circle <items.Circle object at 0x00C0CF18>

and the line responsible for creating the item is as follows:
c = Circle(self._nextRadius(item.getMenuItems()), item.getMenuItems(), self)

How is this possible?

Have to mention that with the same implementation I didn't have that problem
using older version of Qt + PyQt.

Best Regards,
Krystian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070518/d3a9e225/attachment.html


More information about the PyQt mailing list