If an item is simply moved using setPos(), conversion from the item's coordinates to the scene coordinates is as simple as sceneCoord = itemCoord + item->pos(). However, this conversion quickly becomes very complex when you use transformations and parent–child relationships, so you should always use dedicated functions to perform such conversions. QGraphicsItem provides the following functions:
Function | Description |
mapToScene( const QPointF &point) |
Maps the point point that is in the item's coordinate system to the corresponding point in the scene's coordinate system. |
scenePos() |
Maps the item's origin point to the scene's coordinate system. This is the same as mapToScene(0, 0). |