2
votes

Is that possible to create a QGridLayout (with witdh/height boxes fixed) but which can adapt with the widget size.

In other words, when we stretch the width of the widget, the GridLayout is modify.

for example :

I have 4 pictures in my QGridLayout

0,0 | 0,1

1,0 | 1,1

and when I extend my widget (width), I would like pictures position becomes :

0,0 | 0,1 | 0,3

1,0

1

1 Answers

3
votes

Short answer: no. The problem is that the QGridLayout is quite rigid in its structure.

The problem is described in the Qt manual, which also gives an example on how to implement a flow layout (which does exactly what you want): http://qt-project.org/doc/qt-4.8/layouts-flowlayout.html