summaryrefslogtreecommitdiffstats
path: root/qt-ui/models.cpp
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-06-19 18:42:48 -1000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-19 21:53:34 -0700
commit09ee8ece5cf057578b797b78ae023381e853ad58 (patch)
tree6289b9efb22638544003e8a30d04f0f4b0df8650 /qt-ui/models.cpp
parentbc24b9320f4a0994161dcefdd4d34406f461bb9d (diff)
downloadsubsurface-09ee8ece5cf057578b797b78ae023381e853ad58.tar.gz
Show sample pressures in the cylinder equipment page
If we don't have any manually set pressure data, show the data from the samples instead. It uses an italic font for this case, mainly because I couldn't figure out how to gray things out. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r--qt-ui/models.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index c2cce5615..0288e7107 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -78,9 +78,21 @@ QVariant CylindersModel::data(const QModelIndex& index, int role) const
cylinder_t *cyl = &current->cylinder[index.row()];
switch (role) {
- case Qt::FontRole:
- ret = defaultModelFont();
+ case Qt::FontRole: {
+ QFont font = defaultModelFont();
+ switch (index.column()) {
+ case START:
+ if (!cyl->start.mbar)
+ font.setItalic(true);
+ break;
+ case END:
+ if (!cyl->end.mbar)
+ font.setItalic(true);
+ break;
+ }
+ ret = font;
break;
+ }
case Qt::TextAlignmentRole:
ret = Qt::AlignHCenter;
break;
@@ -112,11 +124,15 @@ QVariant CylindersModel::data(const QModelIndex& index, int role) const
break;
case START:
if (cyl->start.mbar)
- ret = get_pressure_string(cyl->start, TRUE);
+ ret = get_pressure_string(cyl->start, FALSE);
+ else if (cyl->sample_start.mbar)
+ ret = get_pressure_string(cyl->sample_start, FALSE);
break;
case END:
if (cyl->end.mbar)
- ret = get_pressure_string(cyl->end, TRUE);
+ ret = get_pressure_string(cyl->end, FALSE);
+ else if (cyl->sample_end.mbar)
+ ret = get_pressure_string(cyl->sample_end, FALSE);
break;
case O2:
ret = percent_string(cyl->gasmix.o2);