Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to clone a QGraphicsItem object?
xtingray last edited by xtingray
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? :)
If you look in source of QGraphicsItem you will see
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.