mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
09b7fcbcf4
commit
f961ec7a8b
4 changed files with 16 additions and 12 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue