mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Update diveplannerpoints cylinderidx when deleting a cylinder
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
parent
df6933326d
commit
73d2ab8099
3 changed files with 10 additions and 5 deletions
|
@ -576,11 +576,8 @@ void CylindersModel::remove(const QModelIndex &index)
|
|||
}
|
||||
changed = true;
|
||||
endRemoveRows();
|
||||
struct divecomputer *dc = &displayed_dive.dc;
|
||||
while (dc) {
|
||||
dc_cylinder_renumber(&displayed_dive, dc, mapping);
|
||||
dc = dc->next;
|
||||
}
|
||||
cylinder_renumber(&displayed_dive, mapping);
|
||||
DivePlannerPointsModel::instance()->cylinderRenumber(mapping);
|
||||
dataChanged(index, index);
|
||||
}
|
||||
|
||||
|
|
|
@ -353,6 +353,13 @@ void DivePlannerPointsModel::gaschange(const QModelIndex &index, int newcylinder
|
|||
emitDataChanged();
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::cylinderRenumber(int mapping[])
|
||||
{
|
||||
for (int i = 0; i < rowCount(); i++)
|
||||
divepoints[i].cylinderid = mapping[divepoints[i].cylinderid];
|
||||
emitDataChanged();
|
||||
}
|
||||
|
||||
QVariant DivePlannerPointsModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
void gaschange(const QModelIndex &index, int newcylinderid);
|
||||
void cylinderRenumber(int mapping[]);
|
||||
void removeSelectedPoints(const QVector<int> &rows);
|
||||
void setPlanMode(Mode mode);
|
||||
bool isPlanner();
|
||||
|
|
Loading…
Reference in a new issue