mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't add half a kilo/pound when adding weights
The weight management widget added 500 grams / 0.5 lbs when a new entry was added. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c5590f835a
commit
a55a2e5d88
1 changed files with 2 additions and 2 deletions
|
@ -167,9 +167,9 @@ QVariant WeightModel::data(const QModelIndex& index, int role) const
|
||||||
if (get_units()->weight == units::KG) {
|
if (get_units()->weight == units::KG) {
|
||||||
int gr = ws->weight.grams % 1000;
|
int gr = ws->weight.grams % 1000;
|
||||||
int kg = ws->weight.grams / 1000;
|
int kg = ws->weight.grams / 1000;
|
||||||
ret = QString("%1.%2").arg(kg).arg((unsigned)(gr + 500) / 100);
|
ret = QString("%1.%2").arg(kg).arg((unsigned) gr / 100);
|
||||||
} else {
|
} else {
|
||||||
ret = QString("%1").arg((unsigned)(grams_to_lbs(ws->weight.grams) + 0.5));
|
ret = QString("%1").arg((unsigned)(grams_to_lbs(ws->weight.grams)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue