summaryrefslogtreecommitdiffstats
path: root/qt-models/cylindermodel.cpp
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-03-20 22:10:42 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-03-24 09:35:51 -0700
commitd83449f3b56c5dbdfbe0f8e5ae908179ba1d6419 (patch)
tree26baa7d0978dd5a81578cad3bae3aff00f0e1c69 /qt-models/cylindermodel.cpp
parentd6003209d6abf715a00802debcd25b145154c8b1 (diff)
downloadsubsurface-d83449f3b56c5dbdfbe0f8e5ae908179ba1d6419.tar.gz
Don't erroneously mark the cylinder pressure red - second try
Second attempt to do the thing with the red background color for cylinder start and end pressure correctly. This now should cover all scenarios. This rewrites and partitially reverts commit b8e044d Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'qt-models/cylindermodel.cpp')
-rw-r--r--qt-models/cylindermodel.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index bca6003b9..84b023234 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -147,8 +147,11 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
// seem implausible
case START:
case END:
- if ((cyl->start.mbar && !cyl->end.mbar && !cyl->sample_end.mbar) ||
- (cyl->end.mbar && cyl->start.mbar <= cyl->end.mbar))
+ pressure_t startp, endp;
+ startp = cyl->start.mbar ? cyl->start : cyl->sample_start;
+ endp = cyl->end.mbar ? cyl->end : cyl->sample_end;
+ if ((startp.mbar && !endp.mbar) ||
+ (endp.mbar && startp.mbar <= endp.mbar))
ret = REDORANGE1_HIGH_TRANS;
break;
}
@@ -157,11 +160,12 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
case Qt::FontRole: {
QFont font = defaultModelFont();
switch (index.column()) {
+ // if we don't have manually set pressure data use italic font
case START:
font.setItalic(!cyl->start.mbar);
break;
case END:
- font.setItalic(!cyl->end.mbar && !cyl->sample_end.mbar);
+ font.setItalic(!cyl->end.mbar);
break;
}
ret = font;