Ok @jensig ,
as a general rule of thumb, don‘t dynamically create widgets in slots such as "button clicks", that‘s bad design and will end up slowing down your application pretty fast and you may loose oversight of what widget was created and still needs to be deleted. Etc.
That said, you can create the QTextEdit during the Button setup and refere it later on.
But, QPushButtons have by default a fixed height and placing the QTextEdit into the gridlayout will result in „streched „ rows like you have it in the op.
Two solutions I can think of:
Nesting layouts
Place your gridlayout and the QTextEdit as Widgets in a QHorizontalLayout. That should solve your issue
stretching the QTextEdit over all rows of the Gridlayout
For that I‘ll adjust my example code:
Right after the QPushbutton create loop:
...
layout_->addWidget(TextEdit,0,SIZE_BITS,SIZE_LONG,1);
addWidget has an overload that allows colmns and rows that it shall span:
void QGridLayout::addWidget(QWidget *widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = ...)
Edit: fixed obious spelling mistakes, creating posts at 1 am on an iPad is apparently not the best idea.