Seems to me you are constructing your GUI inside out (or backwards, depending on your point of view). Usually, the QMainWindow is the topmost widget in an application and other widgets live inside it as children. In your code, "Window" (whatever that is) is the parent of the QMainWindow. Looks like you are hacking away at the FlowLayout example code without really understanding it.

Forget this "Window" class. In the FlowLayout example, this class was used simply to hold the layout and functioned as the top-level application widget. In your case, you should derive your own MainWindow class from QMainWindow if you want all of the bells and whistles (menus, toolbars, status bars, etc) of a QMainWindow.

In your MainWindow constructor, create a QScrollArea and make it the central widget. Create a QWidget and set it as the widget controlled by QScrollArea (QScrollArea::setWidget()). Be sure you also set the QScrollWidget::setWidgetResizable() flag to true. Create the FlowLayout and add it to the QWidget. Create your push buttons and add them to the flow layout.

In main(), create the QApplication, create the MainWindow, call show() on the MainWindow instance, then exec() on the app.