How to get model index from QSortFilterProxyModel's index



  • Hello
    So, I have QSortFilterProxy model and when I filter the list and select the result I want to delete it. to delete the item I need the index in the my model class(QAbstractListModel) but here I have the index in QSortFilterProxy.


  • Moderators

    QSortFilterProxy forwards all calls to your actual model with the mapped /corrected) index.
    So you either can implement QAbstractItemModel::removeRows().
    Or directly use QSortFilterProxyModel::mapToSource() to map from a proxy model index to your model's index.



  • Firstly please elaborate a little code.
    And I think there is a Method QSortFilterProxyModel::mapFromSource which may return the index you want.



    • raven-worx *
      Ok, thanks it works


  • Please comment on the post as solved if the issue is solved.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.