I wanna have a QTextEdit
and QPushButton
in a QBoxLayout
, where the button takes as little size as needed and the textedit all the rest.
So far I came up with this.
QPushButton* button = new QPushButton();
button->setText("Button");
QTextEdit* textedit = new QTextEdit();
QBoxLayout* boxLayout = new QBoxLayout(QBoxLayout::TopToBottom);
boxLayout->addWidget(textedit, 0, Qt::AlignTop);
boxLayout->addWidget(button, 0, Qt::AlignLeading);
mUI->centralWidget->setLayout(boxLayout);
There is still a padding between the textedit and the button. How can I remove it?
Try to remove
Qt::AlignTop
:That worked for me fine