Changeset e7a7bd4d in subsurface


Ignore:
Timestamp:
Jun 11, 2017, 4:03:38 PM (3 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
22e4006
Parents:
1ddda075
git-author:
Lubomir I. Ivanov <neolit123@…> (06/10/17 13:21:08)
git-committer:
Dirk Hohndel <dirk@…> (06/11/17 16:03:38)
Message:

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@…>
Signed-off-by: Dirk Hohndel <dirk@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/qthelper.cpp

    re6d884c re7a7bd4d  
    5252        } else {
    5353                double lbs = grams_to_lbs(weight_in_grams);
    54                 if (lbs >= 40.0)
    55                         lbs = lrint(lbs + 0.5);
    56                 else
    57                         lbs = lrint(lbs + 0.05);
    5854                str = QString("%1").arg(lbs, 0, 'f', lbs >= 40.0 ? 0 : 1);
    5955        }
Note: See TracChangeset for help on using the changeset viewer.