summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-models/divelistmodel.cpp11
-rw-r--r--qt-models/divelistmodel.h1
2 files changed, 12 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()) {
diff --git a/qt-models/divelistmodel.h b/qt-models/divelistmodel.h
index fbeb13486..a19d1b365 100644
--- a/qt-models/divelistmodel.h
+++ b/qt-models/divelistmodel.h
@@ -35,6 +35,7 @@ public:
static DiveListModel *instance();
DiveListModel(QObject *parent = 0);
void addDive(dive *d);
+ void updateDive(dive *d);
void clear();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;