In my opinion, you should follow the steps below.
1:Taken one QScrollarea widget to main window.
2:Taken one QVBoxLayout into QScrollarea.
3:Taken some buttons into QVBoxLayout.
And in your cpp file, you should add some codes in constructors:
ui->verticalLayoutWidget->setBackgroundRole(QPalette::Dark);
ui->scrollArea->takeWidget();
ui->scrollArea->setWidgetResizable(false);
ui->scrollArea->setWidget(ui->verticalLayoutWidget);
good luck.