QSystemLocale Class

The QSystemLocale class can be used to finetune the system locale of the user. \since 4.2. More...

Header: #include <QSystemLocale>

Public Types

struct CurrencyToStringArgument
enum QueryType { LanguageId, ScriptId, TerritoryId, DecimalPoint, GroupSeparator, …, NativeTerritoryName }

Public Functions

Detailed Description

\internal \inmodule QtCore

\ingroupi18n

Warning: This class is only useful in very rare cases. Usually QLocale offers all the functionality required for application development.

QSystemLocale allows to override the values provided by the system locale (QLocale::system()).

See also QLocale.

Member Type Documentation

enum QSystemLocale::QueryType

Specifies the type of information queried by query(). For each value the type of information to return from the query() method is listed.

ConstantValueDescription
QSystemLocale::LanguageId0a uint specifying the language.
QSystemLocale::ScriptId36a uint specifying the script.
QSystemLocale::TerritoryId1a uint specifying the territory.
QSystemLocale::DecimalPoint2a QString specifying the decimal point.
QSystemLocale::GroupSeparator3a QString specifying the group separator.
QSystemLocale::ZeroDigit4a QString specifying the zero digit.
QSystemLocale::NegativeSign5a QString specifying the minus sign.
QSystemLocale::PositiveSign25a QString specifying the plus sign.
QSystemLocale::DateFormatLong6a QString specifying the long date format
QSystemLocale::DateFormatShort7a QString specifying the short date format
QSystemLocale::TimeFormatLong8a QString specifying the long time format
QSystemLocale::TimeFormatShort9a QString specifying the short time format
QSystemLocale::DayNameLong10a QString specifying the name of a weekday. the in variant contains an integer between 1 and 7 (Monday - Sunday)
QSystemLocale::DayNameShort11a QString specifying the short name of a weekday. the in variant contains an integer between 1 and 7 (Monday - Sunday)
QSystemLocale::MonthNameLong13a QString specifying the name of a month. the in variant contains an integer between 1 and 12
QSystemLocale::MonthNameShort14a QString specifying the short name of a month. the in variant contains an integer between 1 and 12
QSystemLocale::DateToStringLong16converts the QDate stored in the in variant to a QString using the long date format
QSystemLocale::DateToStringShort17converts the QDate stored in the in variant to a QString using the short date format
QSystemLocale::TimeToStringLong18converts the QTime stored in the in variant to a QString using the long time format
QSystemLocale::TimeToStringShort19converts the QTime stored in the in variant to a QString using the short time format
QSystemLocale::DateTimeFormatLong20a QString specifying the long date time format
QSystemLocale::DateTimeFormatShort21a QString specifying the short date time format
QSystemLocale::DateTimeToStringLong22converts the QDateTime in the in variant to a QString using the long datetime format
QSystemLocale::DateTimeToStringShort23converts the QDateTime in the in variant to a QString using the short datetime format
QSystemLocale::MeasurementSystem24a QLocale::MeasurementSystem enum specifying the measurement system
QSystemLocale::AMText26a string that represents the system AM designator associated with a 12-hour clock.
QSystemLocale::PMText27a string that represents the system PM designator associated with a 12-hour clock.
QSystemLocale::FirstDayOfWeek28a Qt::DayOfWeek enum specifying the first day of the week
QSystemLocale::CurrencySymbol30a string that represents a currency in a format QLocale::CurrencyFormat.
QSystemLocale::CurrencyToString31a localized string representation of a number with a currency symbol. Converts a QSystemLocale::CurrencyToStringArgument stored in the in variant to a QString.
QSystemLocale::UILanguages33a list of strings representing locale names that could be used for UI translation.
QSystemLocale::StringToStandardQuotation34a QString containing a quoted version of the string ref stored in the in variant using standard quotes.
QSystemLocale::StringToAlternateQuotation35a QString containing a quoted version of the string ref stored in the in variant using alternate quotes.
QSystemLocale::Weekdays29a QList<Qt::DayOfWeek> specifying the regular weekdays
QSystemLocale::LocaleChanged38this type is queried whenever the system locale is changed.
QSystemLocale::ListToSeparatedString37a string that represents a join of a given QStringList with a locale-defined separator.
QSystemLocale::NativeLanguageName39a string that represents the name of the native language.
QSystemLocale::NativeTerritoryName40a string that represents the name of the native territory.

See also FormatType.

Member Function Documentation

QSystemLocale::QSystemLocale()

\internalConstructs a QSystemLocale object.

The constructor will automatically install this object as the system locale. It and the destructor maintain a stack of system locales, with the most-recently-created instance (that hasn't yet been deleted) used as the system locale. This is only intended as a way to let a platform plugin install its own system locale, overriding what might otherwise be provided for its class of platform (as Android does, differing from Linux), and to let tests transiently over-ride the system or plugin-supplied one. As such, there should not be diverse threads creating and destroying QSystemLocale instances concurrently, so no attempt is made at thread-safety in managing the stack.

This constructor also resets the flag that'll prompt QLocale::system() to re-initialize its data, so that instantiating a QSystemLocale (even transiently) triggers a refresh of the system locale's data. This is exploited by some test code.

[virtual noexcept] QSystemLocale::~QSystemLocale()

\internalDeletes the object.