summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/divelistview.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 4a35176b8..df8bd44f6 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -473,12 +473,14 @@ void DiveListView::deleteDive()
// after a dive is deleted the ones following it move forward in the dive_table
// so instead of using the for_each_dive macro I'm using an explicit for loop
// to make this easier to understand
+ int lastDiveNr = -1;
for (i = 0; i < dive_table.nr; i++) {
d = get_dive(i);
if (!d->selected)
continue;
delete_single_dive(i);
i--; // so the next dive isn't skipped... it's now #i
+ lastDiveNr = i;
}
if (amount_selected == 0) {
if (i > 0)
@@ -488,6 +490,11 @@ void DiveListView::deleteDive()
}
mark_divelist_changed(TRUE);
mainWindow()->refreshDisplay();
+ if(lastDiveNr != -1){
+ clearSelection();
+ selectDive(lastDiveNr);
+ rememberSelection();
+ }
}
void DiveListView::testSlot()