summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-03-13 08:25:32 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-03-13 10:26:18 -0700
commit8834fc0443aadfe4e98a2b8db3253a9bf61645f8 (patch)
tree7c12ecf0c6e00aca283c85d5467e2369d1d1d061 /qt-models
parent2b5a2352eadfe992319910495cc11a0a83c4a6cd (diff)
downloadsubsurface-8834fc0443aadfe4e98a2b8db3253a9bf61645f8.tar.gz
Correctly trigger update of cylinder table trash icons in planner
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/cylindermodel.cpp5
-rw-r--r--qt-models/cylindermodel.h1
-rw-r--r--qt-models/diveplannermodel.cpp3
3 files changed, 9 insertions, 0 deletions
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index ad6c502a5..bca6003b9 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -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
diff --git a/qt-models/cylindermodel.h b/qt-models/cylindermodel.h
index 88da8048c..1aa2daaec 100644
--- a/qt-models/cylindermodel.h
+++ b/qt-models/cylindermodel.h
@@ -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;
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index f4b821e6e..26e4fc1ba 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -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()