From 0b318540318ffa62318f0d9b74c2b14306bd0d97 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 11 Nov 2014 22:59:04 -0800 Subject: Deselect dives that are no longer shown as the dive list is filtered This cleans up the way we ensure that all dives are handled as the dive list is filtered. Signed-off-by: Dirk Hohndel --- qt-ui/divelistview.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'qt-ui/divelistview.cpp') diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 0d7c4fa6d..f250e901a 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -314,6 +314,8 @@ void DiveListView::selectDive(int i, bool scrollto, bool toggle) void DiveListView::selectDives(const QList &newDiveSelection) { int firstInList, newSelection; + struct dive *d; + if (!newDiveSelection.count()) return; @@ -335,7 +337,8 @@ void DiveListView::selectDives(const QList &newDiveSelection) newSelection = dive_table.nr - 1; if (newSelection == firstInList) break; - selectDive(newSelection); + if ((d = get_dive(newSelection)) != NULL && !d->hidden_by_filter) + selectDive(newSelection); } QSortFilterProxyModel *m = qobject_cast(model()); QModelIndexList idxList = m->match(m->index(0, 0), DiveTripModel::DIVE_IDX, selected_dive, 2, Qt::MatchRecursive); -- cgit v1.2.3-70-g09d2