diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2018-02-18 21:55:57 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-02-24 11:45:17 -0800 |
commit | 95a23cf4701d4918f866cb5ef1c25a5b2b380096 (patch) | |
tree | d4735ee6e8fe357483f88cab290e1749ad303656 /qt-models | |
parent | 928e7ed8694e49efdabe3502eef32c4519bf6b0c (diff) | |
download | subsurface-95a23cf4701d4918f866cb5ef1c25a5b2b380096.tar.gz |
Use temperature_t for temperatures in struct stats_t
Use struct temperature_t for temperatures in struct stats_t and
use get_temperature_string() when printing these temperatures for
statistics and HTML export.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/yearlystatisticsmodel.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/qt-models/yearlystatisticsmodel.cpp b/qt-models/yearlystatisticsmodel.cpp index 54941ac80..fbc65ccab 100644 --- a/qt-models/yearlystatisticsmodel.cpp +++ b/qt-models/yearlystatisticsmodel.cpp @@ -39,7 +39,6 @@ YearStatisticsItem::YearStatisticsItem(stats_t interval) : stats_interval(interv QVariant YearStatisticsItem::data(int column, int role) const { - double value; QVariant ret; if (role == Qt::FontRole) { @@ -91,19 +90,19 @@ QVariant YearStatisticsItem::data(int column, int role) const ret = get_volume_string(stats_interval.max_sac); break; case AVG_TEMP: - if (stats_interval.combined_temp && stats_interval.combined_count) { - ret = QString::number(stats_interval.combined_temp / stats_interval.combined_count, 'f', 1); + if (stats_interval.combined_temp.mkelvin && stats_interval.combined_count) { + temperature_t avg_temp; + avg_temp.mkelvin = stats_interval.combined_temp.mkelvin / stats_interval.combined_count; + ret = get_temperature_string(avg_temp); } break; case MIN_TEMP: - value = get_temp_units(stats_interval.min_temp, NULL); - if (value > -100.0) - ret = QString::number(value, 'f', 1); + if (stats_interval.min_temp.mkelvin) + ret = get_temperature_string(stats_interval.min_temp); break; case MAX_TEMP: - value = get_temp_units(stats_interval.max_temp, NULL); - if (value > -100.0) - ret = QString::number(value, 'f', 1); + if (stats_interval.max_temp.mkelvin) + ret = get_temperature_string(stats_interval.max_temp); break; } return ret; |