mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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;
|
changed = true;
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
struct divecomputer *dc = &displayed_dive.dc;
|
cylinder_renumber(&displayed_dive, mapping);
|
||||||
while (dc) {
|
DivePlannerPointsModel::instance()->cylinderRenumber(mapping);
|
||||||
dc_cylinder_renumber(&displayed_dive, dc, mapping);
|
|
||||||
dc = dc->next;
|
|
||||||
}
|
|
||||||
dataChanged(index, index);
|
dataChanged(index, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -353,6 +353,13 @@ void DivePlannerPointsModel::gaschange(const QModelIndex &index, int newcylinder
|
||||||
emitDataChanged();
|
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
|
QVariant DivePlannerPointsModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
{
|
{
|
||||||
if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
|
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 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
||||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
void gaschange(const QModelIndex &index, int newcylinderid);
|
void gaschange(const QModelIndex &index, int newcylinderid);
|
||||||
|
void cylinderRenumber(int mapping[]);
|
||||||
void removeSelectedPoints(const QVector<int> &rows);
|
void removeSelectedPoints(const QVector<int> &rows);
|
||||||
void setPlanMode(Mode mode);
|
void setPlanMode(Mode mode);
|
||||||
bool isPlanner();
|
bool isPlanner();
|
||||||
|
|
Loading…
Add table
Reference in a new issue