diff options
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/divetripmodel.cpp | 2 | ||||
-rw-r--r-- | qt-models/divetripmodel.h | 1 | ||||
-rw-r--r-- | qt-models/filtermodels.cpp | 3 |
3 files changed, 4 insertions, 2 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index ada648762..4e8478a33 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -723,6 +723,8 @@ QVariant DiveTripModelTree::data(const QModelIndex &index, int role) const return defaultModelFont(); dive_or_trip entry = tripOrDive(index); + if (role == IS_TRIP_ROLE) + return !!entry.trip; if (entry.trip) return tripData(entry.trip, index.column(), role); else if (entry.dive) diff --git a/qt-models/divetripmodel.h b/qt-models/divetripmodel.h index e0eefb1f0..dc0d4b299 100644 --- a/qt-models/divetripmodel.h +++ b/qt-models/divetripmodel.h @@ -49,6 +49,7 @@ public: enum ExtraRoles { STAR_ROLE = Qt::UserRole + 1, + IS_TRIP_ROLE, DIVE_ROLE, TRIP_ROLE, DIVE_IDX, diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp index 0226e1220..27bb33856 100644 --- a/qt-models/filtermodels.cpp +++ b/qt-models/filtermodels.cpp @@ -228,8 +228,7 @@ void MultiFilterSortModel::myInvalidate() for (int i = 0; i < m->rowCount(QModelIndex()); ++i) { QModelIndex idx = m->index(i, 0, QModelIndex()); - dive_trip *trip = m->data(idx, DiveTripModelBase::TRIP_ROLE).value<dive_trip *>(); - if (trip) { + if (m->data(idx, DiveTripModelBase::IS_TRIP_ROLE).toBool()) { // This is a trip -> loop over all dives and see if any is selected bool showTrip = false; |