Skip to content

Commit

Permalink
use locale for WNumber, WNumberDb, WNumberRate
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Apr 7, 2024
1 parent bfd6e78 commit 73eea91
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/widget/wnumber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
2 changes: 1 addition & 1 deletion src/widget/wnumberdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check failure on line 14 in src/widget/wnumberdb.cpp

View workflow job for this annotation

GitHub Actions / Ubuntu 22.04 (Qt 6.2, gcc)

invalid use of incomplete type ‘class QLocale’
} else {
strDb = "-" + QString(QChar(0x221E));
}
Expand Down
2 changes: 1 addition & 1 deletion src/widget/wnumberrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

0 comments on commit 73eea91

Please sign in to comment.