Revert "Revert "QLocale: Actually get the language script for the system locale""

This reverts commit 449390c3a5.
QLocale::system() should behave consistently.
If UI widgets are consulting the system locale where they should be
consulting their configured UI locale, that is a bug in the UI widget
and should not be "fixed" by breaking QLocale.

Change-Id: Ib31cf7882a28b26f9a018fba3adabba94a8c43bf
Pick-to: 5.15
Fixes: QTBUG-49031
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
bb10
Edward Welbourne 2020-04-20 10:59:30 +02:00
parent 589e34eb32
commit 4c3ec0caa8
1 changed files with 3 additions and 2 deletions

View File

@ -843,6 +843,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const
case ZeroDigit:
return d->zeroDigit();
case LanguageId:
case ScriptId:
case CountryId: {
QString locale = QString::fromLatin1(getWinLocaleName());
QLocale::Language lang;
@ -851,12 +852,12 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const
QLocalePrivate::getLangAndCountry(locale, lang, script, cntry);
if (type == LanguageId)
return lang;
if (type == ScriptId)
return script == QLocale::AnyScript ? fallbackUiLocale().script() : script;
if (cntry == QLocale::AnyCountry)
return fallbackUiLocale().country();
return cntry;
}
case ScriptId:
return QVariant(QLocale::AnyScript);
case MeasurementSystem:
return d->measurementSystem();
case Collation: