diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2018-02-19 21:55:18 +0100 |
---|---|---|
committer | Robert C. Helling <helling@atdotde.de> | 2018-03-05 16:28:18 +0100 |
commit | aacc6886705e720809d253d22e0f6f49444993e0 (patch) | |
tree | 4d8026cae13f8706d2bb904f7115089d60a7d603 /qt-models/cylindermodel.cpp | |
parent | 18c034ea37f830880e4cbf3636819c6be43d0464 (diff) | |
download | subsurface-aacc6886705e720809d253d22e0f6f49444993e0.tar.gz |
Use correct numeric format based on selected locale (Qt domain part)
This changes the numeric format of many values printed to the UI to
reflect the correct numeric format of the selected locale:
- dot or comma as decimal separator
- comma or dot as thousands separator
In the Qt domain the `L` flag is used case specific mostly
in qthelper.cpp.
Then the helper functions get_xxx_string() are used more consistently.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'qt-models/cylindermodel.cpp')
-rw-r--r-- | qt-models/cylindermodel.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp index a5b1b53c0..e81a127a9 100644 --- a/qt-models/cylindermodel.cpp +++ b/qt-models/cylindermodel.cpp @@ -57,7 +57,7 @@ static QString get_cylinder_string(cylinder_t *cyl) unit = CylindersModel::tr("ℓ"); } - return QString("%1").arg(value, 0, 'f', decimals) + unit; + return QString("%L1").arg(value, 0, 'f', decimals) + unit; } static QString gas_volume_string(int ml, const char *tail) @@ -69,7 +69,7 @@ static QString gas_volume_string(int ml, const char *tail) vol = get_volume_units(ml, NULL, &unit); decimals = (vol > 20.0) ? 0 : (vol > 2.0) ? 1 : 2; - return QString("%1 %2 %3").arg(vol, 0, 'f', decimals).arg(unit).arg(tail); + return QString("%L1 %2 %3").arg(vol, 0, 'f', decimals).arg(unit).arg(tail); } static QVariant gas_wp_tooltip(cylinder_t *cyl); @@ -126,7 +126,7 @@ static QVariant percent_string(fraction_t fraction) if (!permille) return QVariant(); - return QString("%1%").arg(permille / 10.0, 0, 'f', 1); + return QString("%L1%").arg(permille / 10.0, 0, 'f', 1); } QVariant CylindersModel::data(const QModelIndex &index, int role) const |