summaryrefslogtreecommitdiffstats
path: root/qt-ui/models.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r--qt-ui/models.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index b76bd6b8e..2a0f9e98e 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -284,14 +284,20 @@ bool CylindersModel::setData(const QModelIndex& index, const QVariant& value, in
break;
case O2:
if (CHANGED(toDouble, "%", "%")) {
- cyl->gasmix.o2.permille = value.toString().remove('%').toDouble() * 10 + 0.5;
- changed = true;
+ int o2 = value.toString().remove('%').toDouble() * 10 + 0.5;
+ if (cyl->gasmix.he.permille + o2 <= 1000) {
+ cyl->gasmix.o2.permille = o2;
+ changed = true;
+ }
}
break;
case HE:
if (CHANGED(toDouble, "%", "%")) {
- cyl->gasmix.he.permille = value.toString().remove('%').toDouble() * 10 + 0.5;
- changed = true;
+ int he = value.toString().remove('%').toDouble() * 10 + 0.5;
+ if (cyl->gasmix.o2.permille + he <= 1000) {
+ cyl->gasmix.he.permille = he;
+ changed = true;
+ }
}
break;
case DEPTH: