What I want to do is to show new QWidget, which is set in QScrollArea. The Grid Layout is set in Scroll Area and than VBox Layout is added to the Grid one.
Program allows to add dynamically Labels in this VBox Layout. I want scroll area has fixed size and when area taken by Labels exceeds scroll area's size (heigth), than scrollbar should appear (and no changes in Scroll Area size).
With my code - adding Labels causes increasing heigth of QWidget (window). Scrollbar can be seen at the beginning but at some point it disappears... like QScrollArea is no more in there...
QWidget* playlistWindow = new QWidget();
playlistWindow->setAcceptDrops(true);
playlistWindow->resize(200, 300);
QScrollArea* scrollArea = new QScrollArea();
scrollArea->setWidget(playlistWindow);
QVBoxLayout* layout = new QVBoxLayout();
QGridLayout* gridLayout = new QGridLayout();
layout->setAlignment(Qt::AlignTop);
scrollArea->setLayout(gridLayout);
gridLayout->addLayout(layout, 0, 0);
scrollArea->setMaximumHeight(300);
scrollArea->show();