Thanks it works, but I still have a few questions:

  1. I created the UI file using Designer. Is it a designer bug that it did not create a layout object?

    Should setSizePolicy(Fixed) not be enough to declare the window of fixed-size? After all that is the definition of Fixed:

    QSizePolicy Class Reference:

    QSizePolicy::Fixed : 0 : The QWidget::sizeHint() is the only acceptable alternative, so the widget can never grow or shrink (e.g. the vertical direction of a push button).
  2. Why does Qt Designer not use this method itself?
  3. Why does Qt Designer by default create a centralWidget(QWidget) and layoutWidget(QVBoxLayout)? What is their use?