Qt 6.12 LTS is out! See what's new in the release
blog
How do I get this QGraphicsView to fit gfx item contents in view so that scroll bars possibly disappear?
-
There is a video showing what's up. In the Logical Rule Widget there is a vertical layout of ListingWidgets, each containing various QGraphicsViews that point to an existing scene somewhere in a tab in a main window of the app.
The listing is not scaling to fit the QGraphicsItem contents.
Here is my relevant code:
def fit_contents_in_view(self): rect = self.scene().itemsBoundingRect() if rect != QRectF(): self.setSceneRect(rect)which is in my gfx.language_gfx_view.LanguageGfxView class. Any idea how best to fit the scene's complete content into a QGraphicView viewing area?
The complete code:
https://github.com/enjoysmath/abstract-spacecraftAlso tried:
def fit_contents_in_view(self): self.fitInView(self.scene().itemsBoundingRect(), Qt.IgnoreAspectRatio)