diff options
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/cylindermodel.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp index c2c94f765..530ea6356 100644 --- a/qt-models/cylindermodel.cpp +++ b/qt-models/cylindermodel.cpp @@ -63,6 +63,8 @@ static QString gas_volume_string(int ml, const char *tail) return QString("%1 %2 %3").arg(vol, 0, 'f', decimals).arg(unit).arg(tail); } +static QVariant gas_wp_tooltip(cylinder_t *cyl); + static QVariant gas_usage_tooltip(cylinder_t *cyl) { pressure_t startp = cyl->start.mbar ? cyl->start : cyl->sample_start; @@ -75,7 +77,7 @@ static QVariant gas_usage_tooltip(cylinder_t *cyl) used = (end && start > end) ? start - end : 0; if (!used) - return QVariant(); + return gas_wp_tooltip(cyl); return gas_volume_string(used, "(") + gas_volume_string(start, " -> ") + @@ -94,6 +96,11 @@ static QVariant gas_volume_tooltip(cylinder_t *cyl, pressure_t p) return gas_volume_string(vol, "(Z=") + QString("%1)").arg(Z, 0, 'f', 3); } +static QVariant gas_wp_tooltip(cylinder_t *cyl) +{ + return gas_volume_tooltip(cyl, cyl->type.workingpressure); +} + static QVariant gas_start_tooltip(cylinder_t *cyl) { return gas_volume_tooltip(cyl, cyl->start.mbar ? cyl->start : cyl->sample_start); @@ -228,9 +235,11 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const case REMOVE: ret = tr("Clicking here will remove this cylinder."); break; + case TYPE: case SIZE: - case WORKINGPRESS: return gas_usage_tooltip(cyl); + case WORKINGPRESS: + return gas_wp_tooltip(cyl); case START: return gas_start_tooltip(cyl); case END: |