I subclassed QGraphicsView and show the widget in my layout. Within the view I naturally have QGraphicsScene.
I can retrieve the QGraphicsScene size perfectly fine (namely 2100x2970 like I set), however the geometry of the QGraphicsView widget is incorrect. Whenever I resize the main window, the layout changes and so does the view widget change. Of course, the size of QGraphicsScene is irrelevant and stays whatever it is. But the widget showing the scrollbars and the scene through the viewport just doesn't provide me with the correct widget width and height.
In the QtDesigner the QGraphicsView widget shows to have QWidget geometry of 1126x643. But I can never retrieve these values in the subclassed QGraphicsView class.
When I know the width (1126 or something else when main window is resized) I can calculate the scale factor for the view (scale factor = 1126 / 2100) to get the scene to cover the full width of the view widget.
In QGraphicsView:
qDebug("scene: %f %f", scene()->width(), scene()->height()); // works (2100x2970)
qDebug("geo: %f %f", geometry().width(), geometry().height()); // does not (0x2970)