title: qt widgets are overlapping when added to another widget
body: <p><strong>Okay so I have done some debugging. I wrote a code to display my QFrame on another QFrame in a simple layout manager. It doesnt work. So the problem is not the code. Its just the way that QFRame cant be displayed on QFrame. Anyone know how to fix this??</strong></p>
  
  <p>/************************************************PREVIOUSLY STUFFFFFFFF (IGNORE) **********************************************************/</p>
  
  <p>I have a class from QWidget class, but I want to add a list of 5 widgets into that top level widget.</p>
  
  <p>When I add them they seem to overlap, even if I arranged them in a horizontal layout. </p>
  
  <p>Is there some parameter I m not setting or missing anything?</p>
  
  <p>The picture has 5 widget spaces and at runtime I create the widgets and fill them. But when I do they get crowded at left for some reason.</p>
  
  <pre><code>sensor1 = new LightWidget(green, this);
  sensor2 = new LightWidget(green, this);
  sensor3 = new LightWidget(green, this);
  sensor4 = new LightWidget(green, this);
  sensor5 = new LightWidget(green, this);
  </code></pre>
  
  <p>Here is the output.. Instead of seeing 5 green circles I see all of them at left on top of other. </p>
  
  <p><img src="https://i.stack.imgur.com/1oLKv.jpg" alt="enter image description here"></p>
  
  <p>Cheers,
  Nick</p>
  
  <p>This is the UI form code... on request... </p>
  
  <pre><code>void setupUi(QWidget *Form)
  {
      if (Form-&gt;objectName().isEmpty())
          Form-&gt;setObjectName(QString::fromUtf8("Form"));
      Form-&gt;resize(762, 150);
      QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
      sizePolicy.setHorizontalStretch(0);
      sizePolicy.setVerticalStretch(0);
      sizePolicy.setHeightForWidth(Form-&gt;sizePolicy().hasHeightForWidth());
      Form-&gt;setSizePolicy(sizePolicy);
      Form-&gt;setMinimumSize(QSize(700, 150));
      Form-&gt;setMaximumSize(QSize(16777215, 150));
      layoutWidget = new QWidget(Form);
      layoutWidget-&gt;setObjectName(QString::fromUtf8("layoutWidget"));
      layoutWidget-&gt;setGeometry(QRect(10, 20, 721, 101));
      layout = new QHBoxLayout(layoutWidget);
      layout-&gt;setObjectName(QString::fromUtf8("layout"));
      layout-&gt;setContentsMargins(0, 0, 0, 0);
      dataLayout = new QVBoxLayout();
      dataLayout-&gt;setObjectName(QString::fromUtf8("dataLayout"));
      posLayout = new QHBoxLayout();
      posLayout-&gt;setObjectName(QString::fromUtf8("posLayout"));
      posLabel = new QLabel(layoutWidget);
      posLabel-&gt;setObjectName(QString::fromUtf8("posLabel"));
  
      posLayout-&gt;addWidget(posLabel);
  
      posValue = new QLabel(layoutWidget);
      posValue-&gt;setObjectName(QString::fromUtf8("posValue"));
      posValue-&gt;setMaximumSize(QSize(16777215, 16777215));
  
      posLayout-&gt;addWidget(posValue);
  
  
      dataLayout-&gt;addLayout(posLayout);
  
      speedLayout = new QHBoxLayout();
      speedLayout-&gt;setObjectName(QString::fromUtf8("speedLayout"));
      speedLabel = new QLabel(layoutWidget);
      speedLabel-&gt;setObjectName(QString::fromUtf8("speedLabel"));
  
      speedLayout-&gt;addWidget(speedLabel);
  
      speedValue = new QLabel(layoutWidget);
      speedValue-&gt;setObjectName(QString::fromUtf8("speedValue"));
  
      speedLayout-&gt;addWidget(speedValue);
  
  
      dataLayout-&gt;addLayout(speedLayout);
  
      angleLayout = new QHBoxLayout();
      angleLayout-&gt;setObjectName(QString::fromUtf8("angleLayout"));
      angleLabel = new QLabel(layoutWidget);
      angleLabel-&gt;setObjectName(QString::fromUtf8("angleLabel"));
  
      angleLayout-&gt;addWidget(angleLabel);
  
      angleValue = new QLabel(layoutWidget);
      angleValue-&gt;setObjectName(QString::fromUtf8("angleValue"));
  
      angleLayout-&gt;addWidget(angleValue);
  
  
      dataLayout-&gt;addLayout(angleLayout);
  
  
      layout-&gt;addLayout(dataLayout);
  
      sensorLayout = new QHBoxLayout();
      sensorLayout-&gt;setObjectName(QString::fromUtf8("sensorLayout"));
      sensor1 = new LightWidget(layoutWidget);
      sensor1-&gt;setObjectName(QString::fromUtf8("sensor1"));
      sensor1-&gt;setEnabled(true);
  
      sensorLayout-&gt;addWidget(sensor1);
  
      sensor2 = new LightWidget(layoutWidget);
      sensor2-&gt;setObjectName(QString::fromUtf8("sensor2"));
  
      sensorLayout-&gt;addWidget(sensor2);
  
      sensor3 = new LightWidget(layoutWidget);
      sensor3-&gt;setObjectName(QString::fromUtf8("sensor3"));
  
      sensorLayout-&gt;addWidget(sensor3);
  
      sensor4 = new LightWidget(layoutWidget);
      sensor4-&gt;setObjectName(QString::fromUtf8("sensor4"));
  
      sensorLayout-&gt;addWidget(sensor4);
  
      sensor5 = new LightWidget(layoutWidget);
      sensor5-&gt;setObjectName(QString::fromUtf8("sensor5"));
  
      sensorLayout-&gt;addWidget(sensor5);
  
  
      layout-&gt;addLayout(sensorLayout);
  
  
      retranslateUi(Form);
  
      QMetaObject::connectSlotsByName(Form);
  } // setupUi
  </code></pre>
  
  <p>The widgets I m adding are of QFrame type.</p>