From a90869861cbc9927af2bbab5a94630e47b33fd5c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 27 Oct 2015 15:45:40 -0700 Subject: 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) --- src/corelib/tools/qlocale_win.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/corelib') 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: -- cgit v1.2.3