diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-12-07 22:23:09 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-12-07 22:23:09 -0800 |
commit | 9e6991a0e16799cbd0205536e23654dce1153c30 (patch) | |
tree | c65dd022e4c4c7313c518190bf9fb74213ff686b /qt-models/divelistmodel.cpp | |
parent | 803f5f9fbf710279ced115e480427e8159e552b0 (diff) | |
download | subsurface-9e6991a0e16799cbd0205536e23654dce1153c30.tar.gz |
QML-UI: we need a way to update the dive model
Otherwise our UI will get out of sync with our dive list.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models/divelistmodel.cpp')
-rw-r--r-- | qt-models/divelistmodel.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index 86c977fc9..ccd5b8afd 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -15,6 +15,17 @@ void DiveListModel::addDive(dive *d) endInsertRows(); } +void DiveListModel::updateDive(dive *d) +{ + for (int i = 0; i < m_dives.count(); i++) { + if (m_dives.at(i).id() == d->id) { + Dive newDive(d); + m_dives.replace(i, newDive); + break; + } + } +} + void DiveListModel::clear() { if (m_dives.count()) { |