diff options
author | Grace Karanja <gracie.karanja89@gmail.com> | 2015-06-10 21:38:14 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-20 14:28:08 -0700 |
commit | 305509ad5f0577de0a9b75311e78a01b19329515 (patch) | |
tree | a076ac57ed94f7b6e4e42e83c5ec4ffbd1c67c75 /qt-models/divelistmodel.cpp | |
parent | 4c40908954ec1490f59b509744e20ae75f21c628 (diff) | |
download | subsurface-305509ad5f0577de0a9b75311e78a01b19329515.tar.gz |
Add dive notes to the divelistmodel
Add the dive notes field into the DiveListModel class.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models/divelistmodel.cpp')
-rw-r--r-- | qt-models/divelistmodel.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index 1786c85e1..c1862b829 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -24,6 +24,7 @@ Dive::Dive(dive *d) setCylinder(QString(d->cylinder[0].type.description)); setSac(QString::number(d->sac)); setLocation(get_dive_location(d)); + setNotes(d->notes); } QString Dive::date() const @@ -143,6 +144,16 @@ void Dive::setDiveNumber(const QString &diveNumber) { m_diveNumber = diveNumber; } +QString Dive::notes() const +{ + return m_notes; +} + +void Dive::setNotes(const QString ¬es) +{ + m_notes = notes; +} + DiveListModel *DiveListModel::m_instance = NULL; @@ -195,6 +206,8 @@ QVariant DiveListModel::data(const QModelIndex &index, int role) const return dive.sac(); else if (role == DiveLocationRole) return dive.location(); + else if (role == DiveNotesRole) + return dive.notes(); return QVariant(); @@ -215,6 +228,7 @@ QHash<int, QByteArray> DiveListModel::roleNames() const roles[DiveGasRole] = "gas"; roles[DiveSacRole] = "sac"; roles[DiveLocationRole] = "location"; + roles[DiveNotesRole] = "notes"; return roles; } |