2

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?

Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
Assoluto
  • 199
  • 3
  • 12

1 Answers1

1

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:

enter image description here

Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
  • Thanks a lot, that's just what I was looking for. – Assoluto Jun 14 '16 at 21:48
  • @Assoluto Yup, this one's actually a special one in that it's in QtQuick 2.5 But for most of your Models/Views you can find them in this list: http://doc.qt.io/qt-5/model-view-programming.html#model-view-classes – Jonathan Mee Jun 14 '16 at 21:56