views:

83

answers:

1

I have an object in python that is derived from QtGui.QGraphicsPixmapItem with a few basic attributes and methods. After calling deepcopy on a reference to this object, I get an error saying that underlying C/C++ object has been deleted when I try to use the copy. I had received this error before, and it occured when I didn't call the base class' constructor in __init__ so I assume this error is because the QtGui.QGraphicsPixmapItem is not being copied.

How do I go about specifying this? All I know is that there is a __deepcopy__ method for this purpose.

+1  A: 

QGraphicsPixmapItem is not copyable. It inherits QGraphicsItem which is declared using the Q_DISABLE_COPY macro which is the same mechanism used for QObjects to disable copying. The documentation explains it a bit better.

Arnold Spence