mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
Dive list: use helper function when restoring selection
Looping over the individual dives will be very slow if there are many of them, as the profile will try to render each of them in succession. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1e4f744165
commit
fa705a5bc9
1 changed files with 3 additions and 10 deletions
|
@ -156,17 +156,10 @@ void DiveListView::restoreSelection()
|
|||
QList<int> divesOnTrip = getDivesInTrip(trip);
|
||||
QList<int> selectedDivesOnTrip = selectedDives.values(trip);
|
||||
|
||||
// Trip was not selected, let's select single-dives.
|
||||
if (trip == NULL || divesOnTrip.count() != selectedDivesOnTrip.count()) {
|
||||
Q_FOREACH (int i, selectedDivesOnTrip) {
|
||||
selectDive(i);
|
||||
}
|
||||
} else {
|
||||
// Only select trip if all of its dives were selected
|
||||
if (trip != NULL && divesOnTrip.count() == selectedDivesOnTrip.count())
|
||||
selectTrip(trip);
|
||||
Q_FOREACH (int i, selectedDivesOnTrip) {
|
||||
selectDive(i);
|
||||
}
|
||||
}
|
||||
selectDives(selectedDivesOnTrip);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue