summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-05-02 14:41:52 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-03 15:02:21 -0700
commitf961ec7a8b399683b5b9aedc56827fa307511487 (patch)
tree5723cc305f2a6252dbc3b681af0643b32e0176e3 /desktop-widgets/divelistview.cpp
parent09b7fcbcf4e26d19529486ddd2a0e672e60dce32 (diff)
downloadsubsurface-f961ec7a8b399683b5b9aedc56827fa307511487.tar.gz
selection: introduce clear_selection() function
The DiveListView would touch the selection-innards directly. Let's encapsulate that. Moreover, take care to reset the trip selection when resetting the core data. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/divelistview.cpp')
-rw-r--r--desktop-widgets/divelistview.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index f95afee25..8edcb0655 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -292,20 +292,9 @@ void DiveListView::selectTrip(dive_trip_t *trip)
void DiveListView::unselectDives()
{
- // make sure we don't try to redraw the dives during the selection change
- current_dive = nullptr;
- amount_selected = 0;
+ clear_selection();
// clear the Qt selection
selectionModel()->clearSelection();
- // clearSelection should emit selectionChanged() but sometimes that
- // appears not to happen
- // since we are unselecting all dives there is no need to use deselect_dive() - that
- // would only cause pointless churn
- int i;
- struct dive *dive;
- for_each_dive (i, dive) {
- dive->selected = false;
- }
}
// This function returns a trip if there is one selected trip or NULL.