mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Change the api to update a single dive
Instead of searching for the dive in the list, just make sure we are given the index. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6f953d51de
commit
ec0fc9d70b
2 changed files with 5 additions and 10 deletions
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue