You use mapToParent() when you want to translate a position in your child widget into the corresponding position in its parent. You use mapToScene() when you want to translate a position from the child to the corresponding position in the scene.
For example, if you are holding a piece of paper in your hand, and you make a mark on the paper 10 cm down from the top and 5 cm from the left edge, that is the mark's position in child (paper) coordinates. If that piece of paper is in a big room, you can walk all around the room with the paper, but the child coordinates don't change. However, mapToParent() tells you where the mark is with respect to the room's dimensions (2 m from the North wall and 3 m from the West wall). When you walk around with the paper, the position in the room (i.e. parent coordinates) changes. If your scene is the building where the room is, then mapToScene tells you where the mark is with respect to the walls of the building, and likewise, walking around will change these coordinates too.
So you use mapToParent when you want to know where something in the child is in the parent's coordinate system, and you use mapToScene when you want to know where it is in the scene.
But, as is explained in the Qt documentation, a child object's position "pos()" is always in parent coordinates.
Bookmarks