scenePos().x() returns 0 because you specified the item's rectangle in scene coordinates instead of its local coordinates. Thus you have placed the item in its desired position not by moving the item in its appropriate place with setPos(). In either case mapToScene(boundingRect().topLeft()) will return the value you want bur you should first consider if you created the item correctly in the first place.
Bookmarks