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 <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-11-11 21:36:51 +01:00 committed by bstoeger
parent a474264cc8
commit e434b5aa40
4 changed files with 5 additions and 4 deletions

View file

@ -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;