diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-08-15 00:23:25 +0200 |
---|---|---|
committer | bstoeger <32835590+bstoeger@users.noreply.github.com> | 2019-09-14 13:20:59 +0200 |
commit | c4831d7ace59590e6cdf3c357eb140d4273a270c (patch) | |
tree | 7ec94dff8912b500b1af26164b5944ea154fba7c /qt-models | |
parent | 4b389e267dcb8fd5dbeb9403fb8faf0f74ec18ce (diff) | |
download | subsurface-c4831d7ace59590e6cdf3c357eb140d4273a270c.tar.gz |
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>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/divelistmodel.cpp | 2 | ||||
-rw-r--r-- | qt-models/divelistmodel.h | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index 1911a8f8d..05cf987c9 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -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; } diff --git a/qt-models/divelistmodel.h b/qt-models/divelistmodel.h index 5bec0de10..9e706dd3d 100644 --- a/qt-models/divelistmodel.h +++ b/qt-models/divelistmodel.h @@ -43,6 +43,7 @@ public: DateTimeRole, IdRole, NumberRole, + LocationRole, }; static DiveListModel *instance(); |