0

I have a model based on QAbstractTableModel that I would like to use to display its content in a list in QML.

Actually, I need to display the first column only.

TableView does not exist in Qt Quick Controls 2 and suffers from performance issue and rendering issues on HiDPI devices.

There is suggestion in this question to use a ListView. But I fail to see how I can tell the model that I need to display the first column only.

Is there any solution for this ?

Denis Rouzaud
  • 2,412
  • 2
  • 26
  • 45
  • 1
    by default only the first list is displayed, maybe your model is particular, you can provide a [mcve] – eyllanesc Nov 02 '18 at 19:55
  • 1
    Refer to [this](https://stackoverflow.com/questions/22249521/is-it-possible-to-use-qabstracttablemodel-with-tableview-from-qtquick-controls?answertab=active#tab-top) , maybe useful ;) you'll find an example of `ListView` – Redanium Nov 04 '18 at 23:31
  • thanks a lot. Indeed, ListView correctly display the first column of table model. – Denis Rouzaud Nov 13 '18 at 06:54

1 Answers1

0

This is automatically done in QML by ListView: the first column from the model is taken for any requested role.

Denis Rouzaud
  • 2,412
  • 2
  • 26
  • 45