title: Dynamically created QWidget in QFormLayout does not have frame, even if explicitly asked to do so
body: <p>I have a little problem with this bit of code:</p>
  
  <pre><code>DatasetWidget::DatasetWidget(QWidget *parent) : QWidget(parent),
  ui(new Ui::DatasetWidget)
  {
      ui-&gt;setupUi(this);
  
      // cut non-ui related stuff here ...
  
      // Add widgets
      for(int loop=0;loop&lt;theAmountOfItemsWeAdd;++loop)
      {
          QLabel * ql=new QLabel("Caption");
          QLineEdit * qle=new QLineEdit(this);
          qle-&gt;setSizePolicy(QSizePolicy::Policy::Expanding,QSizePolicy::Policy::Fixed);
          ui-&gt;formDisp-&gt;addRow(ql,qle); // ui-&gt;formDisp is of type QFormLayout*
      }
  
  // more non-UI related code
  </code></pre>
  
  <p>I'm creating a QLineEdit widget and adding it to a QFormLayout, "formDisp". For some weird reason that I can't figure out, the created QLineEdit does not have any frame and setFrame doesn't enable it.</p>
  
  <p>I furthermore append the relevant parts of the .ui file here:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ui version="4.0"&gt;
   &lt;class&gt;DatasetWidget&lt;/class&gt;
   &lt;widget class="QWidget" name="DatasetWidget"&gt;
    &lt;property name="geometry"&gt;
     &lt;rect&gt;
      &lt;x&gt;0&lt;/x&gt;
      &lt;y&gt;0&lt;/y&gt;
      &lt;width&gt;723&lt;/width&gt;
      &lt;height&gt;591&lt;/height&gt;
     &lt;/rect&gt;
    &lt;/property&gt;
    &lt;property name="sizePolicy"&gt;
     &lt;sizepolicy hsizetype="Preferred" vsizetype="Preferred"&gt;
      &lt;horstretch&gt;0&lt;/horstretch&gt;
      &lt;verstretch&gt;0&lt;/verstretch&gt;
     &lt;/sizepolicy&gt;
    &lt;/property&gt;
    &lt;property name="windowTitle"&gt;
     &lt;string&gt;Datensatz&lt;/string&gt;
    &lt;/property&gt;
    &lt;layout class="QVBoxLayout" name="verticalLayout"&gt;
     &lt;item&gt;
        &lt;widget class="QLabel" name="lblCaptionDatensatz"&gt;
         &lt;property name="text"&gt;
          &lt;string&gt;Datensatz:&lt;/string&gt;
         &lt;/property&gt;
        &lt;/widget&gt;
       &lt;/item&gt;
       &lt;item&gt;
        &lt;widget class="QLabel" name="lblDatensatz"&gt;
         &lt;property name="font"&gt;
          &lt;font&gt;
           &lt;weight&gt;75&lt;/weight&gt;
           &lt;bold&gt;true&lt;/bold&gt;
           &lt;underline&gt;true&lt;/underline&gt;
          &lt;/font&gt;
         &lt;/property&gt;
         &lt;property name="text"&gt;
          &lt;string&gt;C-XXXX-XXX&lt;/string&gt;
         &lt;/property&gt;
        &lt;/widget&gt;
       &lt;/item&gt;
       &lt;item&gt;
        &lt;widget class="QLineEdit" name="leDescriptor"&gt;
         &lt;property name="sizePolicy"&gt;
          &lt;sizepolicy hsizetype="Fixed" vsizetype="Fixed"&gt;
           &lt;horstretch&gt;0&lt;/horstretch&gt;
           &lt;verstretch&gt;0&lt;/verstretch&gt;
          &lt;/sizepolicy&gt;
         &lt;/property&gt;
         &lt;property name="toolTip"&gt;
          &lt;string extracomment="ServiceTag"/&gt;
         &lt;/property&gt;
         &lt;property name="maxLength"&gt;
          &lt;number&gt;7&lt;/number&gt;
         &lt;/property&gt;
        &lt;/widget&gt;
       &lt;/item&gt;
       &lt;item&gt;
        &lt;spacer name="horizontalSpacer"&gt;
         &lt;property name="orientation"&gt;
          &lt;enum&gt;Qt::Horizontal&lt;/enum&gt;
         &lt;/property&gt;
         &lt;property name="sizeHint" stdset="0"&gt;
          &lt;size&gt;
           &lt;width&gt;40&lt;/width&gt;
           &lt;height&gt;20&lt;/height&gt;
          &lt;/size&gt;
         &lt;/property&gt;
        &lt;/spacer&gt;
       &lt;/item&gt;
       &lt;item&gt;
        &lt;widget class="QPushButton" name="cmdDelete"&gt;
         &lt;property name="text"&gt;
          &lt;string/&gt;
         &lt;/property&gt;
         &lt;property name="icon"&gt;
          &lt;iconset resource="hawams.qrc"&gt;
           &lt;normaloff&gt;:/icons/res/trash-3x.png&lt;/normaloff&gt;:/icons/res/trash-    3x.png&lt;/iconset&gt;
         &lt;/property&gt;
        &lt;/widget&gt;
       &lt;/item&gt;
      &lt;/layout&gt;
     &lt;/item&gt;
     &lt;item&gt;
      &lt;layout class="QFormLayout" name="formDisp"/&gt;
     &lt;/item&gt;
     &lt;item&gt;
      &lt;widget class="Line" name="line"&gt;
       &lt;property name="orientation"&gt;
        &lt;enum&gt;Qt::Horizontal&lt;/enum&gt;
       &lt;/property&gt;
      &lt;/widget&gt;
     &lt;/item&gt;
    &lt;/layout&gt;
   &lt;/widget&gt;
  &lt;connections/&gt;
  &lt;/ui&gt;
  </code></pre>
  
  <p>As widgets added in QtCreator look exactly how they are supposed to look, I suppose something about my code must be wrong.</p>
  
  <p><strong>Update:</strong> Problem solved: Surrounding QWidget was being used inside a QListView, where it replaced an older, fixed-size version of the widget. In the code that fills the QListView with items, there was a hard-coded size hint which forced Qt to resize the new (bigger) version of the QWidget and "squeeze" it vertically.
  Conclusion: When you embed a QWidget derivate in buggy old code that resizes it so there isn't enough space anymore to display all items inside the QWidget's layout, things get messy.  </p>