From e434b5aa4066990a1dbf67670e09b650d87be753 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 11 Nov 2019 21:36:51 +0100 Subject: Cleanup: introduce DiveTripModelBase::IS_TRIP_ROLE To test whether an entry is a trip, we passed a pointer to the trip through a QVariant and tested that for null-ity. Passing pointers through QVariants has given us myriads of problems in QML, therefore introduce a bool IS_TRIP_ROLE Signed-off-by: Berthold Stoeger --- desktop-widgets/divelistview.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index 409b22e38..c012b9832 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -348,8 +348,7 @@ void DiveListView::clearTripSelection() // we want to make sure no trips are selected Q_FOREACH (const QModelIndex &index, selectionModel()->selectedRows()) { - dive_trip_t *trip = index.data(DiveTripModelBase::TRIP_ROLE).value(); - if (!trip) + if (!index.data(DiveTripModelBase::IS_TRIP_ROLE).toBool()) continue; selectionModel()->select(index, QItemSelectionModel::Deselect); } -- cgit v1.2.3-70-g09d2