How to make QGridLayout adaptive to the size of the window, so that when I resize it, the amount of cols and rows would change automatically?
Asked
Active
Viewed 382 times
0
-
@hyde Oh, I made a mistake - QGridLayout – Dmitry K. Jan 29 '16 at 21:34
-
If you don't want "flow layout", where items can change rows, but just want more grid layout rows to appear without items "flowing", override resizeEvent and manipulate the layout there based on the new size. – hyde Jan 30 '16 at 05:34
1 Answers
1
That sounds more like a "flow layout", not a grid layout. So no, I don't think QGridLayout
can do that. And there's no predefined FlowLayout class in qt. BUT: I found this via google:
http://doc.qt.io/qt-5/qtwidgets-layouts-flowlayout-example.html
That looks like a semi-official flow-layout implementation.

ThorngardSO
- 1,191
- 7
- 7