1
votes

I am new to Qt in general and QGraphicsView in particular. When I rotate a Qgraphicspixmapitem in it, it appears to move also. I have figured out that this has something to do with the QGraphicsView adjusting to keep the scene in view. I have removed the scroll bars because I don't need them and I want parts of the scene to go out of view without the QGraphicsView changing its view. In other words, I want everything in my QGraphicsView to have absolute positions and I don't want the QGraphicsView to change its viewpoint (or whatever its called, do correct me on the terminologies).

1

1 Answers

1
votes

The function you need is QGraphicsView::setSceneRect :

This property holds the area of the scene visualized by this view. The scene rectangle defines the extent of the scene, and in the view's case, this means the area of the scene that you can navigate using the scroll bars. If unset, or if a null QRectF is set, this property has the same value as QGraphicsScene::sceneRect, and it changes with QGraphicsScene::sceneRect. Otherwise, the view's scene rect is unaffected by the scene.

So, set the sceneRect for your view to the rectangle of the scene that you want in the view, and all should be good.