I have a custom model subclassing QAbstractTableModel. The model contain 4 column of data and in the 5:th column I merge all the data from the other 4 columns.
I want to display one column at a time in a QListView. To select which column to display I want to use a QComboBox. Is there a way to automatically display the available columns in the QComboBox by using the same model as in the QListView?

My thoughts:
  • Using a qproxymodel to read the headerdata and return it in data(index). Set the proxy model in the QComboBox
  • Using two separate models

Any other ideas?

Thanks!