From bf2b794a9af7b0ed9ca2dbf48e12fb221523c645 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 20 Apr 2020 10:59:30 +0200 Subject: Revert "Revert "QLocale: Actually get the language script for the system locale"" This reverts commit 449390c3a5f3a91e3895cbba0a583386e93366b7. 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 Fixes: QTBUG-49031 Reviewed-by: Orgad Shaneh (cherry picked from commit 4c3ec0caa839260c2252115535847b9277be32d7) Reviewed-by: Volker Hilsheimer --- src/corelib/text/qlocale_win.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/corelib/text') diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp index 4a38adf309..ec0f32e28f 100644 --- a/src/corelib/text/qlocale_win.cpp +++ b/src/corelib/text/qlocale_win.cpp @@ -838,6 +838,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; @@ -846,12 +847,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: -- cgit v1.2.3