Borrimoro
Borrimoro

Reputation: 557

QSortFilterProxyModel - find out id index of source model is in proxy model

I have QSortFilterProxyModel and QModelIndex of item in the model that is set as source to QSortFilterProxyModel. I need to know is this QModelIndex included in the SortFilterProxyModel model with current filtering settings or not. How can I do this?

Upvotes: 1

Views: 2448

Answers (1)

evilruff
evilruff

Reputation: 4085

QSortFilterProxyModel * fm;
QModelIndex      sourceIndex;

if (fm->mapFromSource(sourceIndex).isValid()) {
 // element in filter proxy
} else {
 // element is not in filter proxy
}

Upvotes: 3

Related Questions