Change QCollator's default locale to QLocale().collation()
This replaces QLocale::system().collation(), which left client code with no way to change this default. Since QLocale's default is the system locale initially, the old behavior is retained until the first call to QLocale;:setDefault(). Addition of a separate collation locale in 5.14 changed from using the default locale to using the system's collation locale; the present change restores the ability to override this. [ChangeLog][QtCore][QCollator] The default locale used by QCollator is now the collation locale of the default QLocale. This restores the ability (lost at 5.14) to control the locale used by QString::localeAwareCompare(), while retaining the use of a collation locale when the default is the system locale. Task-number: QTBUG-95050 Pick-to: 6.2 6.1 5.15 Change-Id: I232772bb8f23fffd74573174de70ef2deae372a9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
8ffede6543
commit
973ca1fac6
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Copyright (C) 2021 The Qt Company Ltd.
|
||||
** Copyright (C) 2013 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
@ -77,12 +77,16 @@ QT_BEGIN_NAMESPACE
|
||||
/*!
|
||||
\since 5.13
|
||||
|
||||
Constructs a QCollator using the system's default collation locale.
|
||||
Constructs a QCollator using the default locale's collation locale.
|
||||
|
||||
\sa setLocale(), QLocale::collation()
|
||||
The system locale, when used as default locale, may have a collation locale
|
||||
other than itself (e.g. on Unix, if LC_COLLATE is set differently to LANG in
|
||||
the environment). All other locales are their own collation locales.
|
||||
|
||||
\sa setLocale(), QLocale::collation(), QLocale::setDefault()
|
||||
*/
|
||||
QCollator::QCollator()
|
||||
: d(new QCollatorPrivate(QLocale::system().collation()))
|
||||
: d(new QCollatorPrivate(QLocale().collation()))
|
||||
{
|
||||
d->init();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user