From 73eea91ec52f7010660511c10d3a194f883a9ff8 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Sun, 7 Apr 2024 17:46:49 +0200 Subject: [PATCH] use locale for WNumber, WNumberDb, WNumberRate --- src/widget/wnumber.cpp | 4 ++-- src/widget/wnumberdb.cpp | 2 +- src/widget/wnumberrate.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widget/wnumber.cpp b/src/widget/wnumber.cpp index 482eccb6e65..0f57cdc7185 100644 --- a/src/widget/wnumber.cpp +++ b/src/widget/wnumber.cpp @@ -25,8 +25,8 @@ void WNumber::onConnectedControlChanged(double dParameter, double dValue) { void WNumber::setValue(double dValue) { if (m_skinText.contains("%1")) { - setText(m_skinText.arg(QString::number(dValue, 'f', m_iNoDigits))); + setText(m_skinText.arg(QLocale().toString(dValue, 'f', m_iNoDigits))); } else { - setText(m_skinText + QString::number(dValue, 'f', m_iNoDigits)); + setText(m_skinText + QLocale().toString(dValue, 'f', m_iNoDigits)); } } diff --git a/src/widget/wnumberdb.cpp b/src/widget/wnumberdb.cpp index 6eb41d50cf3..5b9e0797315 100644 --- a/src/widget/wnumberdb.cpp +++ b/src/widget/wnumberdb.cpp @@ -11,7 +11,7 @@ void WNumberDb::setValue(double dValue) { QString strDb; if (dValue != 0.0) { double v = ratio2db(dValue); - strDb = QString::number(v, 'f', m_iNoDigits); + strDb = QLocale().toString(v, 'f', m_iNoDigits); } else { strDb = "-" + QString(QChar(0x221E)); } diff --git a/src/widget/wnumberrate.cpp b/src/widget/wnumberrate.cpp index b3539b2bcce..fd45dd86eba 100644 --- a/src/widget/wnumberrate.cpp +++ b/src/widget/wnumberrate.cpp @@ -35,5 +35,5 @@ void WNumberRate::setValue(double dValue) { const double digitFactor = pow(10, m_iNoDigits); // Calculate percentage rounded to the number of digits specified by iNoDigits const double percentage = round((dValue - 1) * 100.0 * digitFactor) / digitFactor; - setText(m_skinText + sign(percentage) + QString::number(fabs(percentage), 'f', m_iNoDigits)); + setText(m_skinText + sign(percentage) + QLocale().toString(fabs(percentage), 'f', m_iNoDigits)); }