Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QGraphicsScene::setSceneRect() does not update immediately



  • Setting scene rectangle using QGraphicsScene::setSceneRect() ocasionally does not result in change of the scene until after a resize event takes place.

    Questions:

    1. Why is this the case?
    2. How can I force the QGraphicsScene to respect the scene assigned to it immediately


  • (One?) Solution is to call QGraphicsView( QRectF ) with QRectF obtained from QGraphicsScene::sceneRect() immediately after assigning a new scene rectangle.