summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-28 13:10:33 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-28 13:10:33 -0700
commitfa705a5bc90553f9aea697ed9eb3881c482ad6df (patch)
treedd6af7835e6e5dda67600bdce4c6c47e31dffc5b /qt-ui
parent1e4f744165608d208690531d5ff5da558ccd31d2 (diff)
downloadsubsurface-fa705a5bc90553f9aea697ed9eb3881c482ad6df.tar.gz
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>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/divelistview.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 45141bfe1..a6cca47b6 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -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);
}
}