- Call base class constructor in MainWindow ctor
- Where do you apply that mainLayout? Create a "central" widget, set mainLayout as it's layout, and set the "central" widget as mainwindow's central widget.

Qt Code:
  1. MainWindow::MainWindow() : QMainWindow()
  2. {
  3. ...
  4.  
  5. QHBoxLayout* mainLayout = new QHBoxLayout;
  6. mainLayout->addWidget(first);
  7. mainLayout->addWidget(second);
  8. mainLayout->addWidget(third);
  9.  
  10. QWidget* central = new QWidget;
  11. central->setLayout(mainLayout);
  12. setCentralWidget(central);
  13. }
To copy to clipboard, switch view to plain text mode