Search code examples
c++qtmodelqstandarditemmodelqsortfilterproxymodel

How to get the source model of a QSortFilterProxyModel in Qt?


I have a QStandardItemModel that is set as source of QSortFilterProxyModel using setSourceModel().

How can I access the QStandardItemModel? I need to know this in order to iterate over the unmodified data.


Solution

  • yourQSortFilterProxyModelinstance->sourceModel() and cast it to QStandardItemModel*