how get filtered data from QSortFilterProxyModel ?
Solved
General and Desktop
-
@paghsa said in how get filtered data from QSortFilterProxyModel ?:
and i filter data according to QSortFilterProxyModel
If you have done this you already have what you ask for? Just iterate/access via the
QSortFilterProxyModel
, whatever filter you have put on it will mean it will only contain/return those filtered rows. For example, once you have set the filter to filter out some rows, compare whatQSortFilterProxyModel::rowCount()
returns versus the source model'sQAbstractItemModel::rowCount()
. -
@JonB
oh god it was dead simple
anyways thanks a lot ;)
for other people who may face to this problem you should use proxy->index() and play with itQModelIndex index = proxyModel->index(row , column , parentIndex); int rowCount = proxy->rowCount(proxyModel); // it gives you the count of rows qInfo() << proxy->data(index , sourceModel::enum); // it prints the corresponding data
in my case i have a treeModel and have to search all filtered rows for particular value.