Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QScrollArea in QGridLayout in multiple cells
m1smr last edited by
I want to add a QScrollArea to a QGridLayout in multiple cells, but the QScrollArea does not use all horizontal space availavble.
I added it like this: layout->addWidget(scrollArea, 0, 0, 1, 2, Qt::AlignCenter);
The ScrollArea is in the center, but it does not use all horizontal space available. How do I do this?
I think you need to say
ui->scrollArea->setWidgetResizable( true );
JonB last edited by JonB
You're probably/doubtless right, but could you explain http://doc.qt.io/qt-5/qscrollarea.html#widgetResizable-prop
If this property is set to true, the scroll area will automatically resize the widget in order to avoid scroll bars where they can be avoided, or to take advantage of extra space.
It may fill the cell initially to "take advantage of extra space", as per OP's requirement, but when it gets filled with content will it "resize the [cell] widget to avoid scroll bars" when we want it to stay same size and scroll instead?