mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Mobile: return dive-number directly from 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. In this case, don't remove from DiveObjectHelper, as this datum might be used by grantlee templates. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
bf081866e9
commit
4b389e267d
3 changed files with 5 additions and 2 deletions
|
@ -186,7 +186,7 @@ Kirigami.ScrollablePage {
|
|||
}
|
||||
Controls.Label {
|
||||
id: numberText
|
||||
text: "#" + dive.number
|
||||
text: "#" + number
|
||||
font.pointSize: subsurfaceTheme.smallPointSize
|
||||
color: innerListItem.checked ? subsurfaceTheme.darkerPrimaryTextColor : secondaryTextColor
|
||||
anchors {
|
||||
|
|
|
@ -255,6 +255,7 @@ QVariant DiveListModel::data(const QModelIndex &index, int role) const
|
|||
localTime.time().toString(prefs.time_format));
|
||||
}
|
||||
case IdRole: return d->id;
|
||||
case NumberRole: return d->number;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -268,6 +269,7 @@ QHash<int, QByteArray> DiveListModel::roleNames() const
|
|||
roles[TripNrDivesRole] = "tripNrDives";
|
||||
roles[DateTimeRole] = "dateTime";
|
||||
roles[IdRole] = "id";
|
||||
roles[NumberRole] = "number";
|
||||
return roles;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,8 @@ public:
|
|||
TripIdRole,
|
||||
TripNrDivesRole,
|
||||
DateTimeRole,
|
||||
IdRole
|
||||
IdRole,
|
||||
NumberRole,
|
||||
};
|
||||
|
||||
static DiveListModel *instance();
|
||||
|
|
Loading…
Reference in a new issue