QVBoxLayout not shown corectly
-
Hi,
I want to create a list of widgets and put the elements in a QVBoxLayout using this code:
fblist is a QList of widget
QVBoxLayout *layout = new QVBoxLayout;
for(int i = 0; i < fblist.size(); i++){ layout->addWidget(fblist.at(i)); }
http://postimage.org/image/vy0vs2rip/
thank you,
-
Try something like this:
@
QWidget widget;QLineEdit* lineEdit = new QLineEdit;
QLabel* label = new QLabel;QVBoxLayout* layout = new QVBoxLayout;
//replace these with your for loop
layout->addWidget( lineEdit );
layout->addWidget( label );// you can use this at the end of the widgets (after the for loop)
layout->addStretch();widget.setLayout( layout ); // important
@