title: In Qt, how do I make a dialog un-resizeable, yet automatically adjusting its size to the contents?
body: <p>I have an instance of QDialog, populated by widgets using code generated by uic. The dialog contains a few labels laid out vertically, and I am popping the dialog from time to time to show some text in these labels. The text can be multi-line and its length is not pre-determined. I set the vertical size policy to fixed, so the user can't drag it (doesn't make sense), but I also want the dialog to change its size before being shown to accomodate for the current size of the labels. </p>
  
  <p>To this end, I was calling QWidget::adjustSize() on the QDialog before displaying it, but it doesn't work as expected. When the dialog is shown, it seems to retain the (wrong) size from the previous displaying, but when I click the mouse in the (disabled) vertical resize mode, the dialog suddenly "snaps" to the (correct) adjusted size.</p>
  
  <p>Is there any way to make my dialog appear correctly?</p>
  
  <p><strong>EDIT:</strong> I tied rubenvb's advice, and ended up with this:</p>
  
  <pre><code>QSizePolicy free(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
  QSizePolicy fixed(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
  dialog-&gt;setSizePolicy(free);
  dialog-&gt;adjustSize();
  dialog-&gt;setSizePolicy(fixed);
  dialog-&gt;show();
  </code></pre>
  
  <p>Unfortunately, that didn't seem to change anything.</p>