summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/tools/qlocale.cpp4
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp10
2 files changed, 12 insertions, 2 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 2ce410062a..c183224c82 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -2115,8 +2115,8 @@ QList<QLocale> QLocale::matchingLocales(QLocale::Language language,
&& (language == QLocale::AnyLanguage || data->m_language_id == uint(language))) {
if ((script == QLocale::AnyScript || data->m_script_id == uint(script))
&& (country == QLocale::AnyCountry || data->m_country_id == uint(country))) {
- QLocale locale(*QLocalePrivate::create(data));
- result.append(locale);
+ result.append(QLocale(*(data->m_language_id == C ? c_private()
+ : QLocalePrivate::create(data))));
}
++data;
}
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index 06b0fe8d51..d18af71e20 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -80,6 +80,7 @@ private slots:
void ctor();
void emptyCtor();
void legacyNames();
+ void consistentC();
void unixLocaleName();
void matchingLocales();
void stringToDouble_data();
@@ -579,6 +580,15 @@ void tst_QLocale::legacyNames()
#undef TEST_CTOR
}
+void tst_QLocale::consistentC()
+{
+ const QLocale c(QLocale::C);
+ QCOMPARE(c, QLocale::c());
+ QCOMPARE(c, QLocale(QLocale::C, QLocale::AnyScript, QLocale::AnyCountry));
+ QVERIFY(QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript,
+ QLocale::AnyCountry).contains(c));
+}
+
void tst_QLocale::matchingLocales()
{
const QLocale c(QLocale::C);