Unsolved How to clone a QGraphicsItem object?
-
Hi,
Maybe this question is too obvious but I really appreciate any help. What is the best way to make an independent copy of a QGraphicsItem object?
QGraphicsPathItem *original = new QGraphicsPathItem; original->setPath(originalPath); QGraphicsPathItem *itemCopy = ???
I want to manipulate the object copy without modifying/altering the original item.
Any hint? :)
-
hi
If you look in source of QGraphicsItem you will seeprivate:
Q_DISABLE_COPY(QGraphicsItem)
Q_DECLARE_PRIVATE(QGraphicsItem)So it is not allowed. ( as far as i know)
So you can not copy or clone it as such.
Only option is to create a new item and then copy the data to the new instance.