Unsolved QScrollArea in QGridLayout in multiple cells
-
Hello,
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?
-
Hi
I think you need to say
ui->scrollArea->setWidgetResizable( true ); -
@mrjj
You're probably/doubtless right, but could you explain http://doc.qt.io/qt-5/qscrollarea.html#widgetResizable-propIf 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?