title: Resize window to fit content
body: <p>I have a QGLWidget, which I want to resize to a given resolution (bigger than the containing window).
  My intention is, that the window expands until the widget fits inside, but can't find a way to do it.</p>
  
  <p>I tried several commands after resizing the QGLWidget to make it work without success.
  I will list the results here:</p>
  
  <ul>
  <li>do nothing else: The Widget overlaps the whole window. Eventually it will be resized to fit back into the smaller window</li>
  <li><code>mainWindow.adjustSize()</code>: The widget gets resized to (0, 0)</li>
  <li><code>mainWindow.resize(mainWindow.sizeHint())</code>: see above</li>
  <li><code>mainWindow.resize(mainWindow.minimumSizeHint())</code>: see above</li>
  </ul>
  
  <p>I also read in <a href="http://qt-project.org/forums/viewthread/4597" rel="noreferrer">this thread</a>, that before doing the mainWindow resize I the event loop needs to be run to recalculate the new sizes, so I inserted <code>QCoreApplication::processEvents</code> to do so, without any visible effect.</p>
  
  <p>So how do I resize the window via the widget?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>The GLWidget is not the only widget of the window.
  It is embedded in splitter together with a group box.</p>