From e7a7bd4de2495d9df668d93016628d722ba4e3b3 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Sat, 10 Jun 2017 23:21:08 +0300 Subject: [PATCH] qthelper.cpp: leave lbs rounding to QString().arg() with 'f' The following call in weight_string(): str = QString("%1").arg(lbs, 0, 'f', lbs >= 40.0 ? 0 : 1); will make values in lbs larger or equal to 40 to have no fractional part and be rounded to nearest, while values less than 40 will have one decimal place. fixes #412 Signed-off-by: Lubomir I. Ivanov Signed-off-by: Dirk Hohndel --- core/qthelper.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core/qthelper.cpp b/core/qthelper.cpp index 811f6538a..2a897e881 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -51,10 +51,6 @@ QString weight_string(int weight_in_grams) str = QString("%1.%2").arg(kg).arg((unsigned)(gr + 50) / 100); } else { double lbs = grams_to_lbs(weight_in_grams); - if (lbs >= 40.0) - lbs = lrint(lbs + 0.5); - else - lbs = lrint(lbs + 0.05); str = QString("%1").arg(lbs, 0, 'f', lbs >= 40.0 ? 0 : 1); } return (str);