summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/divelistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/divelistview.cpp')
-rw-r--r--desktop-widgets/divelistview.cpp22
1 files changed, 2 insertions, 20 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index 3e1ec6baa..403165759 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -263,9 +263,8 @@ void DiveListView::rowsInserted(const QModelIndex &parent, int start, int end)
// Shouldn't the core-layer call us?
void DiveListView::tripChanged(dive_trip *trip, TripField)
{
- // First check if the trip is already selected (and only
- // this trip, as only then is it displayed). Is so, then do nothing.
- if (singleSelectedTrip() == trip)
+ // First check if the trip is already selected (and only this trip, as only then is it displayed).
+ if (single_selected_trip() == trip)
return;
unselectDives();
@@ -297,23 +296,6 @@ void DiveListView::unselectDives()
selectionModel()->clearSelection();
}
-// This function returns a trip if there is one selected trip or NULL.
-// Returning all selected trips turned out to be too slow.
-dive_trip_t *DiveListView::singleSelectedTrip()
-{
- dive_trip_t *res = nullptr;
- for (const QModelIndex &index: selectionModel()->selectedRows()) {
- if (index.parent().isValid())
- continue;
- if (dive_trip_t *trip = index.data(DiveTripModelBase::TRIP_ROLE).value<dive_trip *>()) {
- if (res)
- return nullptr; // More than one
- res = trip;
- }
- }
- return res;
-}
-
bool DiveListView::eventFilter(QObject *, QEvent *event)
{
if (event->type() != QEvent::KeyPress)