mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Mobile: move tripNrDive from DiveObjectHelper to DiveListModel
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this datum directly from the model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
1b9581369a
commit
54720e6cff
5 changed files with 6 additions and 11 deletions
|
@ -245,6 +245,7 @@ QVariant DiveListModel::data(const QModelIndex &index, int role) const
|
|||
case DiveRole: return QVariant::fromValue<QObject*>(curr_dive);
|
||||
case DiveDateRole: return (qlonglong)curr_dive->timestamp();
|
||||
case TripIdRole: return d->divetrip ? QString::number((quint64)d->divetrip, 16) : QString();
|
||||
case TripNrDivesRole: return d->divetrip ? d->divetrip->dives.nr : 0;
|
||||
}
|
||||
return QVariant();
|
||||
|
||||
|
@ -256,6 +257,7 @@ QHash<int, QByteArray> DiveListModel::roleNames() const
|
|||
roles[DiveRole] = "dive";
|
||||
roles[DiveDateRole] = "date";
|
||||
roles[TripIdRole] = "tripId";
|
||||
roles[TripNrDivesRole] = "tripNrDives";
|
||||
return roles;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue