diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-10-09 15:22:49 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-11-08 13:00:39 +0100 |
commit | e330a9bb44fd5deb86a46934b2b45c1ad1f9f70a (patch) | |
tree | 7c480135f3aaed64b49933e859e7c18c0517afe0 | |
parent | 902a5a1ff48bf68af45d6a09fd58bcecb29add6c (diff) |
Replace fallbackUiLocaleData() with fallbackUiLocaleIndex()
This means always initializing globalLocaleData from an entry in the
locale_data array, where in principle the fallbackUiLocale() could be
the system locale, which isn't held in the array. However, no actual
implementation of fallbackUiLocale() uses the system locale (nor is it
clear this would work if one did).
Change-Id: Ie1c5ef3e8a97f21e0d82fa2dfb3cf3eb9e4c8840
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
-rw-r--r-- | src/corelib/text/qlocale.cpp | 2 | ||||
-rw-r--r-- | src/corelib/text/qlocale_p.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 6253766fd5..15a65f2203 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -651,7 +651,7 @@ static void updateSystemPrivate() sys_locale->query(QSystemLocale::LocaleChanged); // Populate global with fallback as basis: - globalLocaleData = *sys_locale->fallbackUiLocaleData(); + globalLocaleData = locale_data[sys_locale->fallbackUiLocaleIndex()]; QVariant res = sys_locale->query(QSystemLocale::LanguageId); if (!res.isNull()) { diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h index 96b4c4c4a0..6367bb1fda 100644 --- a/src/corelib/text/qlocale_p.h +++ b/src/corelib/text/qlocale_p.h @@ -129,7 +129,7 @@ public: virtual QVariant query(QueryType type, QVariant in = QVariant()) const; virtual QLocale fallbackUiLocale() const; - inline const QLocaleData *fallbackUiLocaleData() const; + inline uint fallbackUiLocaleIndex() const; private: QSystemLocale(bool); friend class QSystemLocaleSingleton; @@ -438,7 +438,7 @@ public: }; #ifndef QT_NO_SYSTEMLOCALE -const QLocaleData *QSystemLocale::fallbackUiLocaleData() const { return fallbackUiLocale().d->m_data; } +uint QSystemLocale::fallbackUiLocaleIndex() const { return fallbackUiLocale().d->m_index; } #endif template <> |