summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Benjamin <nystire@gmail.com>2013-10-04 15:49:32 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-04 09:40:05 -0700
commit9961cf13b13b03803b2c96ec5d2221cf18d46588 (patch)
treea2c23d58d47a8248c12dd6f77f5e99507b91e8c5 /qt-ui
parentc28fe00bfe7b0ed747050afc97812a56ccc8a291 (diff)
downloadsubsurface-9961cf13b13b03803b2c96ec5d2221cf18d46588.tar.gz
Use the same conversion grams->lbs in dive and equipment list
Subsurface stores weight values in grams. When displaying lbs, the dive list was not rounding the converted weights up, but rather truncating the value at the decimal place. The equipment list was rounding the converted weights up. This gave two different displayed values for the same weight value. Signed-off-by: Benjamin Fogel <nystire@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/models.cpp3
1 files changed, 2 insertions, 1 deletions
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;