title: QGraphicsView make scene scale to full width
body: <p>I subclassed QGraphicsView and show the widget in my layout. Within the view I naturally have QGraphicsScene.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>In QGraphicsView:</p>
  
  <pre><code>qDebug("scene: %f %f", scene()-&gt;width(), scene()-&gt;height()); // works (2100x2970)
  qDebug("geo: %f %f", geometry().width(), geometry().height()); // does not (0x2970)
  </code></pre>