I want to display a multi column list, so when one column is filled to the bottom of the window subsequent items will be displayed in the next column, something like this:
Item1 Item4 Item7
Item2 Item5 Item8
Item3 Item6 Item9
If the window is resized the items should change columns so the list doesn't extent beyond the bottom of the window.
I tried this with a QTableWidget
, but it's quite slow when you resize the window because you have to move all the QTableWidgetItems
to new positions, and maintaining which items are selected is a bit of a pain.
Is there a better control for doing this, or is QTableWidget
the best option?
You're looking for QGridView
. It will work with Qt's Model/View Paradigm accepting a ListModel
.
Based on the grid layout that you have specified you'll want to set the flow
property to FlowTopToBottom
to achieve something like this: