From 7c5c38b154baeeb05d2c70a3c248cda41349133a Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Sun, 16 Nov 2014 14:04:06 -0200 Subject: Addded a min / max layout for the filter, and a filter count But the filter count seems to be broken for some reason and I really don't know why. It seems to work for tags, but not for everything else. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/filtermodels.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'qt-ui/filtermodels.cpp') diff --git a/qt-ui/filtermodels.cpp b/qt-ui/filtermodels.cpp index 5b2553d96..6751a8cfe 100644 --- a/qt-ui/filtermodels.cpp +++ b/qt-ui/filtermodels.cpp @@ -379,7 +379,7 @@ bool MultiFilterSortModel::filterAcceptsRow(int source_row, const QModelIndex &s if (!model->doFilter(d, index0, sourceModel())) shouldShow = false; } - // if it's a dive, mark it accordingly + filter_dive(d, shouldShow); return shouldShow; } @@ -390,7 +390,11 @@ void MultiFilterSortModel::myInvalidate() struct dive *d; DiveListView *dlv = MainWindow::instance()->dive_list(); + divesDisplayed = 0; + divesFilteredOut = 0; + invalidate(); + // first make sure the trips are no longer shown as selected // (but without updating the selection state of the dives... this just cleans // up an oddity in the filter handling) @@ -412,6 +416,15 @@ void MultiFilterSortModel::myInvalidate() } dlv->selectDives(curSelectedDives); } + + for_each_dive (i,d) { + if (d->hidden_by_filter) + divesFilteredOut++; + else + divesDisplayed++; + } + + emit filterFinished(); } void MultiFilterSortModel::addFilterModel(MultiFilterInterface *model) -- cgit v1.2.3-70-g09d2