aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-09-17 17:31:09 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-09-17 15:28:49 -0700
commitbef8dc6f4b462472dbcced0ea59cac5727bb45be (patch)
treec9ffeb376039eb957c8bbfad5bb90f76875f8590 /qt-ui
parentf1e7c12e8a5e39c32ad74d9b0aee4cb0c0529159 (diff)
downloadsubsurface-bef8dc6f4b462472dbcced0ea59cac5727bb45be.tar.gz
Implement trip-filtering.
Trips will be filtered if it doesn't find any tags for dives. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/models.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index f1f1f636c..e170c4d04 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -2162,8 +2162,14 @@ bool TagFilterSortModel::filterAcceptsRow(int source_row, const QModelIndex &sou
QModelIndex index0 = sourceModel()->index(source_row, 0, source_parent);
QVariant diveVariant = sourceModel()->data(index0, DiveTripModel::DIVE_ROLE);
struct dive* d = (struct dive* ) diveVariant.value<void*>();
- if(!d)
+
+ if (!d) { // It's a trip, only show the ones that have dives to be shown.
+ for(int i = 0; i < sourceModel()->rowCount(index0); i++){
+ if (filterAcceptsRow(i, index0))
+ return true;
+ }
return false;
+ }
// Checked means 'Show', Unchecked means 'Hide'.
struct tag_entry *head = d->tag_list;