Quote Originally Posted by wysota View Post
Widgets and graphics items have different ways of using the geometry so it is natural you will get different results when setting the same values. Widgets always have a rectangle of (0,0,width(), height()) whereas graphics items do not. The origin of the coordinate system of the black graphics item lies outside of the item itself thus the red item is positioned to the left and up of its parents top left corner.
I thought graphics items always have a boundingRect(), which must be implemented by derived class? That boundingRect should be treated no difference from widget rect...Not to mention my example used a rectangle item...

Parent item is child item's container, therefore the child can't go outside its parent boundary, and here is the document in "The Graphics View Framework":

Child coordinates are relative to the parent's coordinates. If the child is untransformed, the difference between a child coordinate and a parent coordinate is the same as the distance between the items in parent coordinates. For example: If an untransformed child item is positioned precisely in its parent's center point, then the two items' coordinate systems will be identical. If the child's position is (10, 0), however, the child's (0, 10) point will correspond to its parent's (10, 10) point.

Because items' position and transformation are relative to the parent, child items' coordinates are unaffected by the parent's transformation, although the parent's transformation implicitly transforms the child. In the above example, even if the parent is rotated and scaled, the child's (0, 10) point will still correspond to the parent's (10, 10) point. Relative to the scene, however, the child will follow the parent's transformation and position. If the parent is scaled (2x, 2x), the child's position will be at scene coordinate (20, 0), and its (10, 0) point will correspond to the point (40, 0) on the scene.