QSystemLocale/Win: use LOCALE_RETURN_NUMBER to get numbers

Instead of parsing from a QString, which actually recurses back into
QSystemLocale.

Pick-to: 6.5
Change-Id: I3c79b7e08fa346988dfefffd171f9b78e1d8d6ce
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Thiago Macieira 2022-10-19 16:15:30 -07:00
parent b33016a492
commit 05e7d09eb3

View File

@ -175,10 +175,11 @@ QVariant QSystemLocalePrivate::getLocaleInfo(LCTYPE type)
int QSystemLocalePrivate::getLocaleInfo_int(LCTYPE type)
{
const QString str = getLocaleInfo(type).toString();
bool ok = false;
const int v = str.toInt(&ok);
return ok ? v : 0;
DWORD value;
int r = GetLocaleInfo(lcid, type | LOCALE_RETURN_NUMBER,
reinterpret_cast<wchar_t *>(&value),
sizeof(value) / sizeof(wchar_t));
return r == sizeof(value) / sizeof(wchar_t) ? value : 0;
}
QSystemLocalePrivate::SubstitutionType QSystemLocalePrivate::substitution()