From 9fae262188afc52eff971b9e81f9f6b61eef88a9 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 25 Apr 2020 15:26:52 +0200 Subject: desktop: fold DiveListView::selectDive into DiveListView::selectDive DiveListView::selectDive() is an overloaded function. The second version was only called by the first version, so we can fold one into the other. Signed-off-by: Berthold Stoeger --- desktop-widgets/divelistview.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'desktop-widgets/divelistview.cpp') diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index b3988c8ff..bce8b2eb3 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -306,19 +306,6 @@ QList DiveListView::selectedTrips() return ret; } -void DiveListView::selectDive(QModelIndex idx) -{ - if (!idx.isValid()) - return; - selectionModel()->setCurrentIndex(idx, QItemSelectionModel::Select | QItemSelectionModel::Rows); - if (idx.parent().isValid()) { - setAnimated(false); - expand(idx.parent()); - setAnimated(true); - } - selectionChangeDone(); -} - void DiveListView::selectDive(int i) { if (i == -1) @@ -328,7 +315,14 @@ void DiveListView::selectDive(int i) if (match.isEmpty()) return; QModelIndex idx = match.first(); - selectDive(idx); + + selectionModel()->setCurrentIndex(idx, QItemSelectionModel::Select | QItemSelectionModel::Rows); + if (idx.parent().isValid()) { + setAnimated(false); + expand(idx.parent()); + setAnimated(true); + } + selectionChangeDone(); } void DiveListView::selectDives(const QList &newDiveSelection) -- cgit v1.2.3-70-g09d2