anda_skoa told you it wouldn't do the trick because you are mixing two coordinate spaces.

Originally Posted by
ayanda83
I want to limit the movement of the child item to the bounds of the parent item
Bounds of the parent item:
QRectF bounds
= parent
->boundingRect
();
QRectF bounds = parent->boundingRect();
To copy to clipboard, switch view to plain text mode
Limit movement of child to that rect:
if(!bounds.contains(pos())) { ... }
if(!bounds.contains(pos())) { ... }
To copy to clipboard, switch view to plain text mode
Riddle:
What coordinate space are we using here?
a) item
b) item's parent
c) scene
Bookmarks