mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Mobile: return location 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
4b389e267d
commit
c4831d7ace
3 changed files with 4 additions and 1 deletions
|
@ -147,7 +147,7 @@ Kirigami.ScrollablePage {
|
|||
anchors.left: leftBarDive.right
|
||||
Controls.Label {
|
||||
id: locationText
|
||||
text: dive.location
|
||||
text: location
|
||||
font.weight: Font.Bold
|
||||
font.pointSize: subsurfaceTheme.regularPointSize
|
||||
elide: Text.ElideRight
|
||||
|
|
|
@ -256,6 +256,7 @@ QVariant DiveListModel::data(const QModelIndex &index, int role) const
|
|||
}
|
||||
case IdRole: return d->id;
|
||||
case NumberRole: return d->number;
|
||||
case LocationRole: return get_dive_location(d);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -270,6 +271,7 @@ QHash<int, QByteArray> DiveListModel::roleNames() const
|
|||
roles[DateTimeRole] = "dateTime";
|
||||
roles[IdRole] = "id";
|
||||
roles[NumberRole] = "number";
|
||||
roles[LocationRole] = "location";
|
||||
return roles;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
DateTimeRole,
|
||||
IdRole,
|
||||
NumberRole,
|
||||
LocationRole,
|
||||
};
|
||||
|
||||
static DiveListModel *instance();
|
||||
|
|
Loading…
Add table
Reference in a new issue