PDA

View Full Version : Graphics item movement and scene bounds



Gianluca Magnani
5th November 2009, 14:12
Hello everybody,
I'm quite new in QT programming, and I'm focusing on drawing and moving elements on a scene (i.e., instance of the QGraphicsScene class).
I used the method "setSceneRect(0, 0, 5000, 5000)" to set the size of the scene.
Every element in the scene (i.e. instance of a class that inherits from QGraphicsRectItem) is movable and selectable. The multiple selection is enabled. I would like to know how can I "limit" the movement of the objects in the scene, and so I would like to stop that movement if the object reach one of the bounds of the scene.
I hope I explained the problem well enough.
Thank you for any help

Gianluca Magnani

gopikrishnav
24th November 2009, 07:13
Just want to understand whether you are trying to call setSceneRect of Scene or QGraphicsView.

wysota
24th November 2009, 09:02
See the example in QGraphicsItem::itemChange() documentation.