A deep copy of the resulting python object

I have an object in python that is derived from QtGui.QGraphicsPixmapItem with several basic attributes and methods. After calling deepcopy in a link to this object, I get the error underlying C/C++ object has been deleted when I try to use a copy. I got this error earlier, and it happened when I did not call the base class constructor in __init__ , so I assume that this error is due to the fact that QtGui.QGraphicsPixmapItem not copied.

How do I determine this? All I know is the __deepcopy__ method for this purpose.

+4
source share
1 answer

QGraphicsPixmapItem not copied. It inherits QGraphicsItem , which is declared using the Q_DISABLE_COPY macro, which is the same mechanism that QObjects uses to disable copying. The documentation explains this a little better .

+3
source

All Articles