[PyQt] Cannot add item to itemgroups while itemchange() is defined

Zoellner, Christian Christian.Zoellner at student.hpi.uni-potsdam.de
Tue May 21 10:56:28 BST 2013


Hello guys,
I currently have a very mysterious problem with PyQT and neither Stackoverflow (http://stackoverflow.com/q/16614187/2394681) nor any of my friends and coworkers can help me with it.
I'm building a PyQt QGraphicsView project where some QGraphicItems can be moved around between different QGraphicsItemGroups. For that, I use the addItemToGroup() method of the "new" parent itemGroup.
This works fine, but only so long as I do not define the itemChange() method in my custom child-item class. Once I define that method (even if I just pass the function call to the super class), the childItems will not be added to ItemGroups no matter what I try.
class MyChildItem(QtGui.QGraphicsItemGroup):
    def itemChange(self, change, value):
        # TODO: Do something for certain cases of ItemPositionChange
        return QtGui.QGraphicsItemGroup.itemChange(self, change, value)
        #return super().itemChange(change, value)   # Tried this variation too
Am I simply too stupid for properly calling a superclass method in Python, or is the problem somewhere in the QT / PyQT magic?
I use Python 3.3 with PyQt 4.8 and QT 5.
I would really appreciate any kind of help or ideas.
Thanks a lot,
Christian Zöllner

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20130521/460d406f/attachment-0001.html>


More information about the PyQt mailing list