PDA

View Full Version : QGraphicsScene auto expanding.



miqqo
18th June 2010, 11:32
Hi everyone,
I have following problem. I am creating program that allows to make network schematics. It is based on QGraphicsScene and QGraphicsItem as network nodes. I'm creating QGraphicsScene with some default size, let's say 800x600. However in case of huge diagrams I need to expand QGraphicScene in order to be able to put so many network nodes as I want to. Is there any simple way to do it, for instance by using scrollbars in order to expand scene into infinity?

SixDegrees
18th June 2010, 11:47
You don't have to set the size of the scene; it automatically expands when new items are added to it.

Infinity, of course, is not an option. Computers are finite.

The GraphicsView itself is derived from a scroll area, and you automatically get scrollbars with it. You can adjust their behavior - whether they're always there, never there or there only when the scene exceeds the view - through the view's settings.

miqqo
7th July 2010, 21:56
Thanks for help. Actually what I was looking for was method QGraphicsScene:setSceneRect() which allows to change scene size. Mayby I didn't precise my question enough ;)