0
votes

I have a QTableView with a custom QSortFilterProxy to be able to search my data over multiple Columns. That works great so far.

Now I would like to display the row count. I would like to have something like current displayed rows / total amount of rows in database.

It's absolutely no problem to get rowCount on program start, but I am not exactly sure how I could recalculate the currently visible rows when the data has been filtered through my QSortFilterProxy.

Any help appreciated. Thank you.

1

1 Answers

1
votes

You can compare return values of rowCount() function of your source and QSortFilterProxyModel models. For example, suppose model is a pointer to your QSortFilterProxyModel, than:

int filteredRowCount = model->rowCount();
int allRowCount = model->sourceModel()->rowCount();