Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
6.5.3, 6.6.2, 6.7.2
-
None
-
-
287f3097f (dev)
Description
Using the locale es_ES (i.e. Spanish (Spain)). When converting numbers between 1000 and 9999 to a string, the thousands separator is not displayed. Numbers equal to or greater than 10000 if displayed correctly.
The following code allows you to display this error:
#include <QLocale> #include <iostream> void testResult(double test, QString expected) { QString result = QLocale::system().toString(test, 'f', 2); std::cout << result.toStdString(); if (result == expected) { std::cout << " CORRECT" << std::endl; } else { std::cout << " WRONG! Must be " << expected.toStdString() << std::endl; } } int main(int argc, char *argv[]) { setlocale(LC_ALL, "es_ES.UTF-8"); std::cout << "Using Qt " << QT_VERSION_STR << std::endl; testResult(1111.11, "1.111,11"); testResult(11111.11, "11.111,11"); testResult(1111111.11, "1.111.111,11"); testResult(11111111.11, "11.111.111,11"); }
Running this code in various Qt environments (5.14.2, 6.5.3 and 6.7.2) yields:
Using Qt 6.7.2 1111,11 WRONG! Must be 1.111,11 11.111,11 CORRECT 1.111.111,11 CORRECT 11.111.111,11 CORRECT
Using Qt 6.5.3 1111,11 WRONG! Must be 1.111,11 11.111,11 CORRECT 1.111.111,11 CORRECT 11.111.111,11 CORRECT
Using Qt 5.14.2 1.111,11 CORRECT 11.111,11 CORRECT 1.111.111,11 CORRECT 11.111.111,11 CORRECT
As you can see, only in Qt 5.14.2 the correct result is shown.
Thanks, Jesús
Attachments
Issue Links
- relates to
-
QTBUG-109955 Implement system query for digit grouping rules
- In Review