How to get model index from QSortFilterProxyModel's index
General and Desktop
5
Posts
3
Posters
4.3k
Views
1
Watching
-
wrote on 26 Jan 2015, 08:30 last edited by
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. -
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. -
wrote on 26 Jan 2015, 08:53 last edited by
Firstly please elaborate a little code.
And I think there is a Method QSortFilterProxyModel::mapFromSource which may return the index you want. -
wrote on 26 Jan 2015, 09:16 last edited by
- raven-worx *
Ok, thanks it works
- raven-worx *
-
wrote on 28 Jan 2015, 05:58 last edited by
Please comment on the post as solved if the issue is solved.
1/5