Important: Please read the Qt Code of Conduct -

QGraphicsView question

  • I'm at the beginning stages of making a game and i have an issue with the QGraphicsView class. For some reason when i set the size of my QGraphicsScene, the view is never large enough to contain it without using scrollbars. You can understand i don't want scrollbars in my game. I disabled the scrollbars but the size of the view still isn't showing the whole scene. It's missing like a good 100 pixels in both height and width. I tried scaling the view, and even though the size is now equal to the scene, the scene and all its items disappear. Scaling doesn't seem to be the answer. Any way of correcting this?


  • I managed to find the solution. Sorry I'm still pretty new to programming and don't fully know how inheritance works. The QGraphicsView is a grandchild (?) of the QWidget. So i was looking at the wrong methods in the QGraphicsView reference. If i call the QWidget's resize method for the view it resizes the view like i want.

Log in to reply