aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/qthelper.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index 0c5446e6a..b9698e6b8 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -43,12 +43,8 @@ QString weight_string(int weight_in_grams)
{
QString str;
if (get_units()->weight == units::KG) {
- int gr = weight_in_grams % 1000;
- int kg = weight_in_grams / 1000;
- if (kg >= 20.0)
- str = QString("%1").arg(kg + (gr >= 500 ? 1 : 0));
- else
- str = QString("%1.%2").arg(kg).arg((unsigned)(gr + 50) / 100);
+ double kg = (double) weight_in_grams / 1000.0;
+ str = QString("%1").arg(kg, 0, 'f', kg >= 20.0 ? 0 : 1);
} else {
double lbs = grams_to_lbs(weight_in_grams);
str = QString("%1").arg(lbs, 0, 'f', lbs >= 40.0 ? 0 : 1);