I have a QVBoxLayout in wich I add dynamically on runtime other QWidget s:
for(int i = 0; i < value; i++)
{
QList<QWidget*> widgetList_i;
//... widgetList_i.append(a lot of widgets)
ui->verticalLayout->addWidget(widget_i);
}
There is a lot of wasted space between those added widgets:
When I run the application, I can compress the heigth, with the mouse.
Limiting each widgetList_i Widget heigth by setMaximumheigth() is a nice approach, but then I have spaces wasten in the beginning and end:
Adding just a ui->vertivalLayout->addStretch(1);
causes empty space at the end. The beginning of that layout is nice:
Main question: Isn't there a function which sets the layouts heigth regarding the added widgets to a minimum?
Side question: How can I add a vertical scrollbar to that widget ?
EDIT: - Adding a spaceritem make it worse: and does not solve my problem