Making a QWidget fill a QGraphicsScene (PySide)
-
In my application I have a QGraphicsView with another QGraphicsView within it (added with addWidget). The smaller QGraphicsView is a map (positioned and sized to a portion of the screen). When the user presses a keyboard shortcut I want the map to fill my entire window (a QMainWindow) I attempted to use setCentralWidget to set the map view to fill the screen, but I only get a blank box that fills the screen (it works fine if I don't add the widget to my QGraphicsScene).
My current (working) implementation is simply resizing the map to fill QGraphicsScene that it is in, I'm only concerned that everything else in my parent QGraphics scene will still drain resources. I'm also not sure that a QStackedLayout would be the route to go, since the map still needs to be part of my QGraphicsScene. I'm wondering if there is a better (or more standard) solution than my current one. -
Just for future reference to anyone who runs across this I ended up going with my current solution. QGraphicsScene is very optimized and seems to do a good job of not bothering with redrawing obscured objects. This approach also allowed me to do some other things visually that would have been much more difficult to implement otherwise.