diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-11-11 22:59:04 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-11-12 14:07:07 -0800 |
commit | 0b318540318ffa62318f0d9b74c2b14306bd0d97 (patch) | |
tree | de4469dfe207955093c2e057b82012c956cc28f1 /qt-ui/divelistview.cpp | |
parent | 71b6de05238907dfa602cd583c5904dd7e6cb8fc (diff) | |
download | subsurface-0b318540318ffa62318f0d9b74c2b14306bd0d97.tar.gz |
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 <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r-- | qt-ui/divelistview.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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<int> &newDiveSelection) { int firstInList, newSelection; + struct dive *d; + if (!newDiveSelection.count()) return; @@ -335,7 +337,8 @@ void DiveListView::selectDives(const QList<int> &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<QSortFilterProxyModel *>(model()); QModelIndexList idxList = m->match(m->index(0, 0), DiveTripModel::DIVE_IDX, selected_dive, 2, Qt::MatchRecursive); |