mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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();
|
endRemoveRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveListModel::updateDive(dive *d)
|
void DiveListModel::updateDive(int i, dive *d)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_dives.count(); i++) {
|
DiveObjectHelper *newDive = new DiveObjectHelper(d);
|
||||||
if (m_dives.at(i)->id() == d->id) {
|
removeDive(i);
|
||||||
DiveObjectHelper *newDive = new DiveObjectHelper(d);
|
insertDive(i, newDive);
|
||||||
removeDive(i);
|
|
||||||
insertDive(i, newDive);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveListModel::clear()
|
void DiveListModel::clear()
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
void addDive(dive *d);
|
void addDive(dive *d);
|
||||||
void insertDive(int i, DiveObjectHelper *newDive);
|
void insertDive(int i, DiveObjectHelper *newDive);
|
||||||
void removeDive(int i);
|
void removeDive(int i);
|
||||||
void updateDive(dive *d);
|
void updateDive(int i, dive *d);
|
||||||
void clear();
|
void clear();
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
|
|
Loading…
Add table
Reference in a new issue