mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Fix edit + cancel = absolute zero
If a temperature in Kelvin is 0, I think we can safely assume it is not set. Fixes #207. Signed-off-by: Patrick Valsecchi <patrick@thus.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a13992a44b
commit
d0e9d1f383
1 changed files with 3 additions and 1 deletions
|
@ -269,7 +269,9 @@ QString get_cylinder_used_gas_string(cylinder_t *cyl, bool showunit)
|
||||||
|
|
||||||
QString get_temperature_string(temperature_t temp, bool showunit)
|
QString get_temperature_string(temperature_t temp, bool showunit)
|
||||||
{
|
{
|
||||||
if (prefs.units.temperature == units::CELSIUS) {
|
if (temp.mkelvin == 0) {
|
||||||
|
return ""; //temperature not defined
|
||||||
|
} else if (prefs.units.temperature == units::CELSIUS) {
|
||||||
double celsius = mkelvin_to_C(temp.mkelvin);
|
double celsius = mkelvin_to_C(temp.mkelvin);
|
||||||
return QString("%1%2%3").arg(celsius, 0, 'f', 1).arg(showunit ? (UTF8_DEGREE): "")
|
return QString("%1%2%3").arg(celsius, 0, 'f', 1).arg(showunit ? (UTF8_DEGREE): "")
|
||||||
.arg(showunit ? tr("C") : "");
|
.arg(showunit ? tr("C") : "");
|
||||||
|
|
Loading…
Reference in a new issue