I’m trying to implement a layout like the file explorer in thumbnails mode. The items are in a grid with fixed distance between them and when you resize the main window, the items are re-positioned to fit.
For example, on a small window you have:
i1 i2 i3 j1 j2 j3 k1 k2 k3
But when the window is wider, the items become:
i1 i2 i3 j1 j2 j3 k1 k2 k3
And if you make the window even wider, the items become:
i1 i2 i3 j1 j2 j3 k1 k2 k3
I’m trying to implement it as simply as possible, maybe using only the default classes?…
The HBoxLayout doesn’t overflow if you put an infinite number of items; they just line up infinitely.
The GridLayout cannot help, because after you put the items first, after a window resize, you have to clean the layout, re-calculate the number of items, re-populate the layout with the new order. It doesn’t reposition the items automatically.
Another way could be to put items in a TableWidget, Qt3 style. But that’s just the same; after window resize, you have calculate how many items fit in the new window, clean the table and re-populate.
There is also the fix position method. You put the items in fixed position and move them after each window resize… it’s a headache.
Did anyone try something like that – an explorer or image viewer? How did you resolve this issue?
I think you need to look into doing something like the FlowLayout from the example set. Note that there is a python port of it.