summaryrefslogtreecommitdiffstats
path: root/core/qthelper.cpp
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-06-10 23:21:08 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-06-11 16:03:38 -0700
commite7a7bd4de2495d9df668d93016628d722ba4e3b3 (patch)
treef28fe027a535f79a18bfddc29536d94e8f3f708e /core/qthelper.cpp
parent1ddda0755b070ac916f54345c3ad2f7b4a4b80db (diff)
downloadsubsurface-e7a7bd4de2495d9df668d93016628d722ba4e3b3.tar.gz
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>
Diffstat (limited to 'core/qthelper.cpp')
-rw-r--r--core/qthelper.cpp4
1 files changed, 0 insertions, 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);