View Full Version : [QGraphicsView] Auto adjusting QGraphicsScene

21st March 2009, 22:17
I have QGraphicsView on my form, and QGraphicsScene attached to it.
On QGraphicsScene I have QPixmap item, and when I call pixmap->setPos(0, 0) I'd like pixmap to move exactly to left top corner of QGraphicsView.
To reach such an effect QGraphicsScene must be expanded at whole QGraphicsView.
In other words, QGraphicsScene's width and height must be the same as QGraphicsView's.
How can I do it?
I searched for function like QGraphicsScene::setAutoExpanding but I haven't found anything.

Thanks in advance!

21st March 2009, 22:31
The scene mustn't have the same size as the view. Just use QGraphicsView::alignment and setViewportMargins() then anything should work.