From d83449f3b56c5dbdfbe0f8e5ae908179ba1d6419 Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Mon, 20 Mar 2017 22:10:42 +0100 Subject: 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 --- qt-models/cylindermodel.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'qt-models/cylindermodel.cpp') 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; -- cgit v1.2.3-70-g09d2