Qt World Summit: Submit your Presentation

QGraphicsView reach outside scene

  • Hi,
    I have a QGraphicsScene which I have added some rectangles. The QGraphicsView is able to display them with the horizontal and vertical scrollbars such that the view can only scroll to the leftmost/rightmost uppermost/lowermost rectangle. but i want the QGraphicsView to be able to scroll a distance far from the leftmost/rightmost, etc. How do I achieve that?

  • @amsantosr

    You need to enlarge your QGraphicsScene. The QGraphicsView just the view of a specific part of your scene.

    If you increase your scene's width and height, you can scroll to empty areas (where you dont have any rectangles)

  • Yes that worked, by using setSceneRect.

Log in to reply