I'm trying to find a way to mark the border of a QGraphicsScene
, and make it resizable inside a QGraphicsView
, to create something similar to Microsoft Paint.
In other words, my current QGraphicsView
looks like this:
But my image is only this big, as indicated by the red box:
I want my QGraphicsView
to be like this (the little black boxes are cornergrabbers for resizing the canvas):
Functionally, I want it to be similar to MS Paint:
The canvas (scene) is resizable, and the scrollbars on the window (view) appear when needed. The blue background color (solid gray background) appears behind the canvas.
How would I go about accomplishing this?
To try to get the grey background, I've been experimenting with QGraphicsView.setBackgroundBrush()
and QGraphicsScene.setBackgroundBrush()
. I've learned that QGraphicsView
's background brush completely overrides QGraphicsScene
's background brush if one is set. Even if I only set the background brush for QGraphicsScene
, that background brush extends over the image's original boundaries.
Here is a link to my test code. Help is appreciated!