Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to only display specific columns using QIdentityProxyModel



  • I have a tableview with n columns, new columns can be added and removed dynamically.
    I now want to display that tableview, but only display two very specific columns (I do have the indices of those columns).

    I tried to set up proxy models to only return something valid for indicies of those columns, or to change columnCount but neither method worked - what am I missing?



  • Just found out about QSortFilterProxyModel::filterAcceptsColumn which provides an integer for the column-index and hence suits my usecase perfectly. Still unsure why I couldn't get it to work with map(From/To)Source though