diff options
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/divelistmodel.cpp | 2 | ||||
-rw-r--r-- | qt-models/divetripmodel.cpp | 11 | ||||
-rw-r--r-- | qt-models/filtermodels.cpp | 4 |
3 files changed, 8 insertions, 9 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index 75eb9137a..b12786fa9 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -100,7 +100,7 @@ void DiveListSortModel::updateDivesShownInTrips() struct dive_trip *dt = dive_trip_list; int rc = rowCount(); while (dt) { - dt->showndives = rc ? 0 : dt->nrdives; + dt->showndives = rc ? 0 : dt->dives.nr; dt = dt->next; } for (int i = 0; i < rowCount(); i++) { diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 7c5bb4efb..6eadbbb24 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -57,20 +57,19 @@ QVariant DiveTripModel::tripData(const dive_trip *trip, int column, int role) switch (column) { case DiveTripModel::NR: QString shownText; - struct dive *d = trip->dives; int countShown = 0; - while (d) { + for (int i = 0; i < trip->dives.nr; ++i) { + struct dive *d = trip->dives.dives[i]; if (!d->hidden_by_filter) countShown++; oneDayTrip &= is_same_day (trip->when, d->when); - d = d->next; } - if (countShown < trip->nrdives) + if (countShown < trip->dives.nr) shownText = tr("(%1 shown)").arg(countShown); if (!empty_string(trip->location)) - return QString(trip->location) + ", " + get_trip_date_string(trip->when, trip->nrdives, oneDayTrip) + " "+ shownText; + return QString(trip->location) + ", " + get_trip_date_string(trip->when, trip->dives.nr, oneDayTrip) + " "+ shownText; else - return get_trip_date_string(trip->when, trip->nrdives, oneDayTrip) + shownText; + return get_trip_date_string(trip->when, trip->dives.nr, oneDayTrip) + shownText; } } diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp index d335d3f7c..d485684f3 100644 --- a/qt-models/filtermodels.cpp +++ b/qt-models/filtermodels.cpp @@ -634,8 +634,8 @@ bool MultiFilterSortModel::filterAcceptsRow(int source_row, const QModelIndex &s return false; // Oops. Neither dive nor trip, something is seriously wrong. // Show the trip if any dive is visible - for (d = trip->dives; d; d = d->next) { - if (!d->hidden_by_filter) + for (int i = 0; i < trip->dives.nr; ++i) { + if (!trip->dives.dives[i]->hidden_by_filter) return true; } return false; |