Correctly trigger update of cylinder table trash icons in planner

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
Stefan Fuchs 2017-03-13 08:25:32 +01:00 committed by Dirk Hohndel
parent 2b5a2352ea
commit 8834fc0443
3 changed files with 9 additions and 0 deletions

View file

@ -600,6 +600,11 @@ void CylindersModel::updateDecoDepths(pressure_t olddecopo2)
emit dataChanged(createIndex(0, 0), createIndex(MAX_CYLINDERS - 1, COLUMNS - 1));
}
void CylindersModel::updateTrashIcon()
{
emit dataChanged(createIndex(0, 0), createIndex(MAX_CYLINDERS - 1, 0));
}
bool CylindersModel::updateBestMixes()
{
// Check if any of the cylinders are best mixes, update if needed

View file

@ -38,6 +38,7 @@ public:
void updateDive();
void copyFromDive(struct dive *d);
void updateDecoDepths(pressure_t olddecopo2);
void updateTrashIcon();
cylinder_t *cylinderAt(const QModelIndex &index);
bool changed;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;

View file

@ -24,6 +24,7 @@ void DivePlannerPointsModel::removeSelectedPoints(const QVector<int> &rows)
divepoints.remove(v2[i]);
}
endRemoveRows();
CylindersModel::instance()->updateTrashIcon();
}
void DivePlannerPointsModel::createSimpleDive()
@ -314,6 +315,7 @@ bool DivePlannerPointsModel::setData(const QModelIndex &index, const QVariant &v
case GAS:
if (value.toInt() >= 0 && value.toInt() < MAX_CYLINDERS)
p.cylinderid = value.toInt();
CylindersModel::instance()->updateTrashIcon();
break;
}
editStop(index.row(), p);
@ -732,6 +734,7 @@ void DivePlannerPointsModel::remove(const QModelIndex &index)
divepoints.remove(index.row());
}
endRemoveRows();
CylindersModel::instance()->updateTrashIcon();
}
struct diveplan &DivePlannerPointsModel::getDiveplan()