diff options
-rw-r--r-- | qt-models/divelistmodel.cpp | 13 | ||||
-rw-r--r-- | qt-models/divelistmodel.h | 2 |
2 files changed, 5 insertions, 10 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index 6e0804743..6706d9137 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -30,16 +30,11 @@ void DiveListModel::removeDive(int i) endRemoveRows(); } -void DiveListModel::updateDive(dive *d) +void DiveListModel::updateDive(int i, dive *d) { - for (int i = 0; i < m_dives.count(); i++) { - if (m_dives.at(i)->id() == d->id) { - DiveObjectHelper *newDive = new DiveObjectHelper(d); - removeDive(i); - insertDive(i, newDive); - break; - } - } + DiveObjectHelper *newDive = new DiveObjectHelper(d); + removeDive(i); + insertDive(i, newDive); } void DiveListModel::clear() diff --git a/qt-models/divelistmodel.h b/qt-models/divelistmodel.h index adc298515..8f52680a4 100644 --- a/qt-models/divelistmodel.h +++ b/qt-models/divelistmodel.h @@ -22,7 +22,7 @@ public: void addDive(dive *d); void insertDive(int i, DiveObjectHelper *newDive); void removeDive(int i); - void updateDive(dive *d); + void updateDive(int i, dive *d); void clear(); int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |