From: Anne-Marie Mahfouf Date: Sun, 13 Jun 2004 00:53:06 +0000 (+0000) Subject: make the temperature update correctly in the small info dialog X-Git-Tag: v3.80.2~300^2~165 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=b48ccb7a0421d5e9cfc0adb2f1051885ecca8733;p=libqmvoc.git make the temperature update correctly in the small info dialog svn path=/trunk/kdeedu/kalzium/src/element.cpp; revision=320141 --- diff --git a/kalzium/src/element.cpp b/kalzium/src/element.cpp index 40e19a7..aee8f52 100644 --- a/kalzium/src/element.cpp +++ b/kalzium/src/element.cpp @@ -104,17 +104,22 @@ const QString Element::adjustUnits( double val, const int type ) } else if ( type == TEMPERATURE ) // convert a temperature { - if ( Prefs::temperature() == 0 ) - { - val+=272.25; - v = QString::number( val ); - v.append( "°C" ); - } - else // use Kelvin - { - v = QString::number( val ); - v.append( "K" ); - } + switch (Prefs::temperature()) { + case 0: //Kelvin + v = QString::number( val ); + v.append( "K" ); + break; + case 1:// Kelvin to Fahrenheit + val = val * 1.8 - 459.67; + v = QString::number( val ); + v.append( "F" ); + break; + case 2: //Kelvin to Celsius + val-=273.15; + v = QString::number( val ); + v.append( "°C" ); + break; + } } else if ( type == LENGHT ) // its a length {