I programmatically move the items in my QGraphicsScene
and they end up in the wrong places. They end up at coordinates (2x, 2y), instead of (x, y).
Somewhere I am changing the wrong thing. I work both with the scene and with individual items, accessing both through pointers.
QGraphicsItem::pos()
can give you the position in scene coordinates (it has no parent).
QGraphicsScene
holds a list of all the items within the scene:
QList<QGraphicsItem *> QGraphicsScene::items () const
.
My question: the information of where an item is on the scene - is it stored within the scene or within the item?
Thanks!
In item i.e. in qgraphicsitem pimpl class. Open qgraphicsitem_p.h and there you will find QPointF pos member.