mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QL UI: Add DiveId role to DiveListModel
This will be used when rendering the dive profile and also when saving the dive changes. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
This commit is contained in:
parent
5d12723656
commit
aae27629c4
2 changed files with 20 additions and 1 deletions
|
@ -5,6 +5,7 @@ MobileDive::MobileDive(dive *d)
|
|||
{
|
||||
m_thisDive = d;
|
||||
setDiveNumber(QString::number(d->number));
|
||||
setDiveId(QString::number(d->id));
|
||||
|
||||
dive_trip *trip = d->divetrip;
|
||||
|
||||
|
@ -216,6 +217,16 @@ void MobileDive::setupDiveTempDetails()
|
|||
setWatertemp(get_temperature_string(m_thisDive->watertemp, true));
|
||||
setAirTemp(get_temperature_string(m_thisDive->airtemp, true));
|
||||
}
|
||||
QString MobileDive::diveId() const
|
||||
{
|
||||
return m_diveId;
|
||||
}
|
||||
|
||||
void MobileDive::setDiveId(const QString &diveId)
|
||||
{
|
||||
m_diveId = diveId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -283,6 +294,8 @@ QVariant DiveListModel::data(const QModelIndex &index, int role) const
|
|||
return dive.buddy();
|
||||
else if (role == DiveMasterRole)
|
||||
return dive.divemaster();
|
||||
else if (role == DiveIdRole)
|
||||
return dive.diveId();
|
||||
return QVariant();
|
||||
|
||||
|
||||
|
@ -308,6 +321,7 @@ QHash<int, QByteArray> DiveListModel::roleNames() const
|
|||
roles[DiveNotesRole] = "notes";
|
||||
roles[DiveBuddyRole] = "buddy";
|
||||
roles[DiveMasterRole] = "divemaster";
|
||||
roles[DiveIdRole] = "id";
|
||||
|
||||
return roles;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue