Try to remove Qt::AlignTop
:
QPushButton* button = new QPushButton();
button->setText("Button");
QTextEdit* textedit = new QTextEdit();
QBoxLayout* boxLayout = new QBoxLayout(QBoxLayout::TopToBottom);
boxLayout->addWidget(textedit, 0);
boxLayout->addWidget(button, 0, Qt::AlignLeading);
mUI->centralWidget->setLayout(boxLayout);
That worked for me fine