summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-07-07 13:51:20 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-07 09:18:07 -0700
commita7969d108376dee6fd11d50bc22c1c5056a2562d (patch)
tree7ab3b92a92da5326b4efca513b2e95b25d69fd3f
parent3d511fe26b16fa19e0d0b3376bc32fb0b54dd719 (diff)
downloadsubsurface-a7969d108376dee6fd11d50bc22c1c5056a2562d.tar.gz
Planner: don't allow negative depths
This patch allows only non-negative depths in the divepoints table as negative depths confuse the planenr/deco algortihm. The spinbox appearing in the table should get a setMinimum(0) but I was not able to find the correct way to implement that. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/diveplanner.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 08e67e00a..631d605cf 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -545,7 +545,8 @@ bool DivePlannerPointsModel::setData(const QModelIndex &index, const QVariant &v
divedatapoint &p = divepoints[index.row()];
switch (index.column()) {
case DEPTH:
- p.depth = units_to_depth(value.toInt());
+ if (value.toInt() >= 0)
+ p.depth = units_to_depth(value.toInt());
break;
case RUNTIME:
p.time = value.toInt() * 60;