title: Qt: How to resize a window to its new content
body: <p>I have a window containing a <code>QScrollArea</code> with a couple widgets in it.</p>
  
  <p>Until now, I was creating the <code>QScrollArea</code> and its child widgets in the constructor of my window, and then I was resizing the window vertically to fit its content using <code>resize(400, sizeHint().height())</code>.  So far, so good.</p>
  
  <p>Now, I'm adding or removing widgets in the <code>QScrollArea</code> at runtime.  What should I do, after having added or removed widgets, to make the window fits its content vertically?  Should I call <code>adjustSize()</code>?  <code>resize(sizeHint())</code>?  Should there be a call to <code>layout-&gt;activate()</code> or maybe <code>updateGeometry()</code> first?  Which size policies actually matter in this case?  The ones of the window, or of the scroll area, or both?  I tried to set them all to <code>Expanding</code>.</p>
  
  <p>I'm using Qt 4.6 on Windows.</p>