Use QDateTimeParser::locale(), not the default QLocale

QDateTimeParser::parseSection() used the default locale instead of the
one configured.

Change-Id: Ie31aa87670cc5ceaf8d937a907807445f44bf7f9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
bb10
Edward Welbourne 2020-09-16 16:29:54 +02:00
parent 61bd6afe39
commit 10cb65fbf6
1 changed files with 2 additions and 2 deletions

View File

@ -817,7 +817,7 @@ QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionIndex, i
}
const int absMax = absoluteMax(sectionIndex);
QLocale loc;
const QLocale loc = locale();
bool ok = true;
int last = -1, used = -1;
@ -825,7 +825,7 @@ QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionIndex, i
QStringView digitsStr = sectionTextRef.left(sectiontextSize);
for (int digits = sectiontextSize; digits >= 1; --digits) {
digitsStr.truncate(digits);
int tmp = (int)loc.toUInt(digitsStr, &ok);
int tmp = int(loc.toUInt(digitsStr, &ok));
if (ok && sn.type == Hour12Section) {
if (tmp > 12) {
tmp = -1;