title: Qt adding custom widget to a layout
body: <p>I realized that I cant add any custom widgets to any layouts so I made this example. This ex creates two buttons - the regular "works1" in the correct place in the mainWindow but the custom widget shows up after it, in a separate window.</p>
  
  <p>I also have a message in the output win saying</p>
  
  <p>QWindowsWindow::setGeometry: Unable to set geometry 75x23+520+285 on QWidgetWindow/'QPushButtonClassWindow'. Resulting geometry:  116x23+520+285 (frame: 8, 30, 8, 8, custom margin: 0, 0, 0, 0, minimum size: 0x0, maximum size: 16777215x16777215).
  QWindowsWindow::setGeometry: Unable to set geometry 100x100+520+285 on QWidgetWindow/'QPushButtonClassWindow'. Resulting geometry:  116x100+520+285 (frame: 8, 30, 8, 8, custom margin: 0, 0, 0, 0, minimum size: 0x0, maximum size: 16777215x16777215). </p>
  
  <pre><code>int main(int argc, char *argv[])
  {
      QApplication a(argc, argv);
      QMainWindow w;
  
      QWidget *topWidget = new QWidget;
      w.setCentralWidget(topWidget);
  
      QHBoxLayout *mainLayout = new QHBoxLayout(topWidget);
  
      QPushButton *myButton = new QPushButton("works1");
      mainLayout-&gt;addWidget(myButton);
  
      MyCustomWidget *newCustom = new MyCustomWidget;
      newCustom-&gt;show();
      mainLayout-&gt;addWidget(newCustom);
  
      w.show();
  
      return a.exec();
  }
  
  
  MyCustomWidget::MyCustomWidget(QWidget *parent) : QWidget(parent)
  {
      QPushButton *myButton = new QPushButton("works2");
      myButton-&gt;setVisible(1);
      myButton-&gt;resize(100, 100);
  }
  
  
  class MyCustomWidget : public QWidget
  {
  //    Q_OBJECT
  public:
      MyCustomWidget(QWidget *parent = 0);
  
  signals:
  
  public slots:
  
  };
  </code></pre>