From e26ac9e58dfc75ca735ac0f59d4f912319be6ae2 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 25 Apr 2020 15:19:35 +0200 Subject: [PATCH] desktop: remove selection-code to select a new current_dive The undo-machinery makes sure that a current_dive always exists after an undo command. This part of the code should never be called. Signed-off-by: Berthold Stoeger --- desktop-widgets/divelistview.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index f72c8ed5b..c2b72fbed 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -337,9 +337,6 @@ void DiveListView::selectDive(int i, bool scrollto) void DiveListView::selectDives(const QList &newDiveSelection) { - int firstInList, newSelection; - struct dive *d; - if (!newDiveSelection.count()) return; @@ -350,22 +347,10 @@ void DiveListView::selectDives(const QList &newDiveSelection) // becomes the selected_dive that we scroll to QList sortedSelection = newDiveSelection; std::sort(sortedSelection.begin(), sortedSelection.end()); - newSelection = firstInList = sortedSelection.first(); while (!sortedSelection.isEmpty()) selectDive(sortedSelection.takeLast()); - while (!current_dive) { - // that can happen if we restored a selection after edit - // and the only selected dive is no longer visible because of a filter - newSelection--; - if (newSelection < 0) - newSelection = dive_table.nr - 1; - if (newSelection == firstInList) - break; - if ((d = get_dive(newSelection)) != NULL && !d->hidden_by_filter) - selectDive(newSelection); - } QAbstractItemModel *m = model(); QModelIndexList idxList = m->match(m->index(0, 0), DiveTripModelBase::DIVE_IDX, get_divenr(current_dive), 2, Qt::MatchRecursive); if (!idxList.isEmpty()) {