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 <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Lubomir I. Ivanov 2017-06-10 23:21:08 +03:00 committed by Dirk Hohndel
parent 1ddda0755b
commit e7a7bd4de2

View file

@ -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);