summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-gui.cpp5
-rw-r--r--qt-ui/models.cpp3
2 files changed, 5 insertions, 3 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp
index 64a125dcb..78138ad3a 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -217,8 +217,9 @@ QString get_depth_unit()
QString get_weight_string(weight_t weight, bool showunit)
{
if (prefs.units.weight == units::KG) {
- double kg = weight.grams / 1000.0;
- return QString("%1%2").arg(kg, 0, 'f', kg >= 20.0 ? 0 : 1 ).arg(showunit ? _("kg") : "");
+ int gr = weight.grams % 1000;
+ int kg = weight.grams / 1000;
+ return QString("%1.%2%3").arg(kg).arg((unsigned)(gr) / 100).arg(showunit ? _("kg") : "");
} else {
double lbs = grams_to_lbs(weight.grams);
return QString("%1%2").arg(lbs, 0, 'f', lbs >= 40.0 ? 0 : 1 ).arg(showunit ? _("lbs") : "");
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 6831b9271..752f3ddf3 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -1114,7 +1114,8 @@ QString DiveItem::displayWeight() const
int kg = weight() / 1000;
str = QString("%1.%2").arg(kg).arg((unsigned)(gr) / 100);
} else {
- str = QString("%1").arg((unsigned)(grams_to_lbs(weight())));
+ double lbs = grams_to_lbs(weight());
+ str = QString("%1").arg(lbs, 0, 'f', lbs >= 40.0 ? 0 : 1 );
}
return str;