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>
This commit is contained in:
Stefan Fuchs 2017-03-20 22:10:42 +01:00 committed by Dirk Hohndel
parent d6003209d6
commit d83449f3b5

View file

@ -147,8 +147,11 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
// seem implausible // seem implausible
case START: case START:
case END: case END:
if ((cyl->start.mbar && !cyl->end.mbar && !cyl->sample_end.mbar) || pressure_t startp, endp;
(cyl->end.mbar && cyl->start.mbar <= cyl->end.mbar)) 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; ret = REDORANGE1_HIGH_TRANS;
break; break;
} }
@ -157,11 +160,12 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
case Qt::FontRole: { case Qt::FontRole: {
QFont font = defaultModelFont(); QFont font = defaultModelFont();
switch (index.column()) { switch (index.column()) {
// if we don't have manually set pressure data use italic font
case START: case START:
font.setItalic(!cyl->start.mbar); font.setItalic(!cyl->start.mbar);
break; break;
case END: case END:
font.setItalic(!cyl->end.mbar && !cyl->sample_end.mbar); font.setItalic(!cyl->end.mbar);
break; break;
} }
ret = font; ret = font;