PDA

View Full Version : Expand QGraphicsScene at runtime



sean.reynolds
18th April 2011, 14:11
Hey Guys,

Im trying to implement a QGraphicsScene which contains QGraphicsItems.
Items can be dragged around the scene, however if they are dragged outside the scene, they are currently being clipped. I would like a scroll bar allowing the user to expand to this new area rather than just clipping the items and loosing them off screen.

I understand that the QGraphicsScene expands to the used space if setSceneRect is not defined or is null.

However when multiple items are on the boundary of the scene, they start getting pushed to the boundary of the new expanded scene (if that makes sense...). I'm after expandind the scene, but not changing the current position of the items within this scene.

Are there any samples for expanding QGraphicsScenes available?

wysota
18th April 2011, 15:17
You can redefine the scene rect manually whenever you want if the default behaviour is not suitable for you.