diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-10-27 15:45:40 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-10-28 21:02:56 +0000 |
commit | a90869861cbc9927af2bbab5a94630e47b33fd5c (patch) | |
tree | 311715e6fe73c5e3e5f87a0aca60acb6ab01314b /src/corelib | |
parent | 9b30c159426333b73565dd97dd705b1b11b8c1fc (diff) |
QLocale: Actually get the language script for the system locale
The Windows code was always returning AnyScript, which in turn made
QLocale::textDirection() for the default and system locales always
return LTR, even if the Windows UI was in RTL mode.
[ChangeLog][QtCore][QLocale] Fixed a bug that caused
QLocale::textDirection() to always return Qt::LeftToRight and
QLocale::script() to return QLocale::AnyScript on for the Windows system
locale.
Task-number: QTBUG-49031
Change-Id: I7e6338336dd6468ead24ffff14112c8d348eedba
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qlocale_win.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index 4781bab172..574453f4ca 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -807,6 +807,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case ZeroDigit: return d->zeroDigit(); case LanguageId: + case ScriptId: case CountryId: { QString locale = QString::fromLatin1(getWinLocaleName()); QLocale::Language lang; @@ -815,12 +816,12 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) 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 AMText: |