summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-25 15:26:52 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-25 10:23:05 -0700
commit9fae262188afc52eff971b9e81f9f6b61eef88a9 (patch)
tree76b3efe4ed6e67bfc05a5c346d79298c5f803e44 /desktop-widgets
parentf8d3501c22d5b37c5c727f6819025b58b7b7b289 (diff)
downloadsubsurface-9fae262188afc52eff971b9e81f9f6b61eef88a9.tar.gz
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divelistview.cpp22
-rw-r--r--desktop-widgets/divelistview.h1
2 files changed, 8 insertions, 15 deletions
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<dive_trip_t *> 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<int> &newDiveSelection)
diff --git a/desktop-widgets/divelistview.h b/desktop-widgets/divelistview.h
index f372edc46..ffaf6c78f 100644
--- a/desktop-widgets/divelistview.h
+++ b/desktop-widgets/divelistview.h
@@ -86,7 +86,6 @@ private:
void addToTrip(int delta);
void matchImagesToDives(QStringList fileNames);
void loadImageFromURL(QUrl url);
- void selectDive(QModelIndex index);
void selectDive(int dive_table_idx);
QNetworkAccessManager manager;
};