Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
#include <qlocale.h>
Public Member Functions | |
QLocale () | |
Constructs a QLocale object initialized with the default locale. | |
QLocale (const QString &name) | |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QLocale (QStringView name) | |
\variable QLocale::DefaultTwoDigitBaseYear | |
QLocale (Language language, Territory territory) | |
Constructs a QLocale object for the specified language and territory. | |
QLocale (Language language, Script script=AnyScript, Territory territory=AnyTerritory) | |
QLocale (const QLocale &other) noexcept | |
Constructs a QLocale object as a copy of other. | |
QLocale & | operator= (const QLocale &other) noexcept |
Assigns other to this QLocale object and returns a reference to this QLocale object. | |
~QLocale () | |
Destructor. | |
void | swap (QLocale &other) noexcept |
Language | language () const |
Returns the language of this locale. | |
Script | script () const |
Territory | territory () const |
QString | name (TagSeparator separator=TagSeparator::Underscore) const |
The short name of this locale. | |
QString | bcp47Name (TagSeparator separator=TagSeparator::Dash) const |
Returns the BCP47 field names joined with dashes. | |
QString | nativeLanguageName () const |
QString | nativeTerritoryName () const |
short | toShort (const QString &s, bool *ok=nullptr) const |
Returns the short int represented by the localized string s. | |
ushort | toUShort (const QString &s, bool *ok=nullptr) const |
Returns the unsigned short int represented by the localized string s. | |
int | toInt (const QString &s, bool *ok=nullptr) const |
Returns the int represented by the localized string s. | |
uint | toUInt (const QString &s, bool *ok=nullptr) const |
Returns the unsigned int represented by the localized string s. | |
long | toLong (const QString &s, bool *ok=nullptr) const |
ulong | toULong (const QString &s, bool *ok=nullptr) const |
qlonglong | toLongLong (const QString &s, bool *ok=nullptr) const |
Returns the long long int represented by the localized string s. | |
qulonglong | toULongLong (const QString &s, bool *ok=nullptr) const |
Returns the unsigned long long int represented by the localized string s. | |
float | toFloat (const QString &s, bool *ok=nullptr) const |
Returns the float represented by the localized string s. | |
double | toDouble (const QString &s, bool *ok=nullptr) const |
Returns the double represented by the localized string s. | |
short | toShort (QStringView s, bool *ok=nullptr) const |
Returns the short int represented by the localized string s. | |
ushort | toUShort (QStringView s, bool *ok=nullptr) const |
Returns the unsigned short int represented by the localized string s. | |
int | toInt (QStringView s, bool *ok=nullptr) const |
Returns the int represented by the localized string s. | |
uint | toUInt (QStringView s, bool *ok=nullptr) const |
Returns the unsigned int represented by the localized string s. | |
long | toLong (QStringView s, bool *ok=nullptr) const |
ulong | toULong (QStringView s, bool *ok=nullptr) const |
qlonglong | toLongLong (QStringView s, bool *ok=nullptr) const |
Returns the long long int represented by the localized string s. | |
qulonglong | toULongLong (QStringView s, bool *ok=nullptr) const |
Returns the unsigned long long int represented by the localized string s. | |
float | toFloat (QStringView s, bool *ok=nullptr) const |
Returns the float represented by the localized string s. | |
double | toDouble (QStringView s, bool *ok=nullptr) const |
Returns the double represented by the localized string s. | |
QString | toString (qlonglong i) const |
Returns a localized string representation of i. | |
QString | toString (qulonglong i) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QString | toString (long i) const |
QString | toString (ulong i) const |
QString | toString (short i) const |
QString | toString (ushort i) const |
QString | toString (int i) const |
QString | toString (uint i) const |
QString | toString (double f, char format='g', int precision=6) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a string representing the floating-point number f. | |
QString | toString (float f, char format='g', int precision=6) const |
QString | toString (QDate date, const QString &format) const |
Returns a localized string representation of the given date in the specified format. | |
QString | toString (QTime time, const QString &format) const |
Returns a localized string representation of the given time according to the specified format. | |
QString | toString (const QDateTime &dateTime, const QString &format) const |
QString | toString (QDate date, QStringView format) const |
QString | toString (QTime time, QStringView format) const |
QString | toString (const QDateTime &dateTime, QStringView format) const |
QString | toString (QDate date, FormatType format=LongFormat) const |
QString | toString (QTime time, FormatType format=LongFormat) const |
Returns a localized string representation of the given time in the specified format (see timeFormat()). | |
QString | toString (const QDateTime &dateTime, FormatType format=LongFormat) const |
QString | toString (QDate date, QStringView format, QCalendar cal) const |
QString | toString (QDate date, FormatType format, QCalendar cal) const |
QString | toString (const QDateTime &dateTime, FormatType format, QCalendar cal) const |
QString | toString (const QDateTime &dateTime, QStringView format, QCalendar cal) const |
QString | dateFormat (FormatType format=LongFormat) const |
QString | timeFormat (FormatType format=LongFormat) const |
QString | dateTimeFormat (FormatType format=LongFormat) const |
QString | decimalPoint () const |
QString | groupSeparator () const |
QString | percent () const |
QString | zeroDigit () const |
QString | negativeSign () const |
QString | positiveSign () const |
QString | exponential () const |
QString | monthName (int, FormatType format=LongFormat) const |
QString | standaloneMonthName (int, FormatType format=LongFormat) const |
QString | dayName (int, FormatType format=LongFormat) const |
QString | standaloneDayName (int, FormatType format=LongFormat) const |
Qt::DayOfWeek | firstDayOfWeek () const |
QList< Qt::DayOfWeek > | weekdays () const |
QString | amText () const |
QString | pmText () const |
MeasurementSystem | measurementSystem () const |
QLocale | collation () const |
Qt::LayoutDirection | textDirection () const |
QString | toUpper (const QString &str) const |
QString | toLower (const QString &str) const |
QString | currencySymbol (CurrencySymbolFormat=CurrencySymbol) const |
QString | toCurrencyString (qlonglong, const QString &symbol=QString()) const |
QString | toCurrencyString (qulonglong, const QString &symbol=QString()) const |
QString | toCurrencyString (short i, const QString &symbol=QString()) const |
QString | toCurrencyString (ushort i, const QString &symbol=QString()) const |
QString | toCurrencyString (int i, const QString &symbol=QString()) const |
QString | toCurrencyString (uint i, const QString &symbol=QString()) const |
QString | toCurrencyString (double, const QString &symbol=QString(), int precision=-1) const |
QString | toCurrencyString (float i, const QString &symbol=QString(), int precision=-1) const |
QString | formattedDataSize (qint64 bytes, int precision=2, DataSizeFormats format=DataSizeIecFormat) const |
QStringList | uiLanguages (TagSeparator separator=TagSeparator::Dash) const |
List of locale names for use in selecting translations. | |
void | setNumberOptions (NumberOptions options) |
NumberOptions | numberOptions () const |
QString | quoteString (const QString &str, QuotationStyle style=StandardQuotation) const |
QString | quoteString (QStringView str, QuotationStyle style=StandardQuotation) const |
QString | createSeparatedList (const QStringList &strl) const |
Static Public Member Functions | |
static QString | languageToCode (Language language, LanguageCodeTypes codeTypes=AnyLanguageCode) |
Returns the two- or three-letter language code for language, as defined in the ISO 639 standards. | |
static Language | codeToLanguage (QStringView languageCode, LanguageCodeTypes codeTypes=AnyLanguageCode) noexcept |
Returns the QLocale::Language enum corresponding to the two- or three-letter languageCode, as defined in the ISO 639 standards. | |
static QString | territoryToCode (Territory territory) |
static Territory | codeToTerritory (QStringView territoryCode) noexcept |
static QString | scriptToCode (Script script) |
Returns the four-letter script code for script, as defined in the ISO 15924 standard. | |
static Script | codeToScript (QStringView scriptCode) noexcept |
Returns the QLocale::Script enum corresponding to the four-letter script scriptCode, as defined in the ISO 15924 standard. | |
static QString | languageToString (Language language) |
Returns a QString containing the name of language. | |
static QString | territoryToString (Territory territory) |
static QString | scriptToString (Script script) |
static void | setDefault (const QLocale &locale) |
\nonreentrant | |
static QLocale | c () |
Returns a QLocale object initialized to the "C" locale. | |
static QLocale | system () |
Returns a QLocale object initialized to the system locale. | |
static QList< QLocale > | matchingLocales (QLocale::Language language, QLocale::Script script, QLocale::Territory territory) |
Returns a list of valid locale objects that match the given language, script and territory. | |
Static Public Attributes | |
static constexpr int | DefaultTwoDigitBaseYear = 1900 |
Friends | |
class | QString |
class | QByteArray |
class | QIntValidator |
class | QDoubleValidatorPrivate |
class | QTextStream |
class | QTextStreamPrivate |
class | QLocalePrivate |
class | QSystemLocale |
class | QCalendarBackend |
class | QRomanCalendar |
Q_CORE_EXPORT size_t | qHash (const QLocale &key, size_t seed) noexcept |
bool | comparesEqual (const QLocale &lhs, const QLocale &rhs) noexcept |
Related Symbols | |
(Note that these are not member symbols.) | |
size_t | qHash (const QLocale &key, size_t seed) noexcept |
using QLocale::Territory = Country |
enum QLocale::Country : ushort |
Specifies the format for representation of data quantities.
\omitvalue DataSizeBase1000 \omitvalue DataSizeSIQuantifiers \value DataSizeIecFormat format using base 1024 and IEC prefixes: KiB, MiB, GiB, ... \value DataSizeTraditionalFormat format using base 1024 and SI prefixes: kB, MB, GB, ... \value DataSizeSIFormat format using base 1000 and SI prefixes: kB, MB, GB, ...
Enumerator | |
---|---|
DataSizeBase1000 | |
DataSizeSIQuantifiers | |
DataSizeIecFormat | |
DataSizeTraditionalFormat | |
DataSizeSIFormat |
enum QLocale::FormatType |
enum QLocale::Language : ushort |
enum QLocale::Script : ushort |
|
strong |
Indicate how to combine the parts that make up a locale identifier.
A locale identifier may be made up of several tags, indicating language, script and territory (plus, potentially, other details), joined together to form the identifier. Various standards and conventional forms use either a dash (the Unicode HYPHEN-MINUS, U+002D) or an underscore (LOW LINE, U+005F). Different clients of QLocale may thus need one or the other.
\value Dash Use {'-'}, the dash or hyphen character. \value Underscore Use
{'_'}, the underscore character.
Enumerator | |
---|---|
Dash | |
Underscore |
QLocale::QLocale | ( | ) |
Constructs a QLocale object initialized with the default locale.
If no default locale was set using setDefault(), this locale will be the same as the one returned by system().
Definition at line 1070 of file qlocale.cpp.
References systemData().
Referenced by matchingLocales(), and system().
|
explicit |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
explicit |
\variable QLocale::DefaultTwoDigitBaseYear
The default start year of the century within which a format taking a two-digit year will select. The value of the constant is {1900}
.
Some locales use, particularly for ShortFormat, only the last two digits of the year. Proir to 6.7 the year 1900 was always used as a base year for such cases. Now various QLocale and QDate functions have the overloads that allow callers to specify the base year, and this constant is used as its default value.
Constructs a QLocale object with the specified name.
The name has the format "language[_script][_territory][.codeset][@modifier]" or "C", where:
\list
The separator can be either underscore {'_'} (U+005F, "low line") or a dash
{'-'} (U+002D, "hyphen-minus"). If QLocale has no data for the specified combination of language, script, and territory, then it uses the most suitable match it can find instead. If the string violates the locale format, or no suitable data can be found for the specified keys, the "C" locale is used instead.
This constructor is much slower than QLocale(Language, Script, Territory) or QLocale(Language, Territory).
Definition at line 1051 of file qlocale.cpp.
Constructs a QLocale object for the specified language and territory.
If there is more than one script in use for this combination, a likely script will be selected. If QLocale has no data for the specified language, the default locale is used. If QLocale has no data for the specified combination of language and territory, an alternative territory may be used instead.
Definition at line 1089 of file qlocale.cpp.
QLocale::QLocale | ( | Language | language, |
Script | script = AnyScript, | ||
Territory | territory = AnyTerritory ) |
Constructs a QLocale object for the specified language, script and territory.
If QLocale does not have data for the given combination, it will find data for as good a match as it can. It falls back on the default locale if
\list
AnyLanguage
and no language can be inferred from script and territory Definition at line 1113 of file qlocale.cpp.
|
defaultnoexcept |
Constructs a QLocale object as a copy of other.
QLocale::~QLocale | ( | ) |
Destructor.
Definition at line 1128 of file qlocale.cpp.
QString QLocale::amText | ( | ) | const |
Returns the localized name of the "AM" suffix for times specified using the conventions of the 12-hour clock.
Definition at line 3439 of file qlocale.cpp.
References am_data, QSystemLocale::AMText, QLocalePrivate::m_data, systemLocale(), and systemLocaleData.
Referenced by QAndroidSystemLocale::query().
QString QLocale::bcp47Name | ( | TagSeparator | separator = TagSeparator::Dash | ) | const |
Returns the BCP47 field names joined with dashes.
This combines as many of language, script and territory (and possibly other BCP47 fields) for this locale as are needed to uniquely specify it. Note that fields may be omitted if the Unicode consortium's \l {Matching combinations of language, script and territory}{Likely Subtag Rules} imply the omitted fields when given those retained. See \l name() for how to construct a string from individual fields, if some other format is needed.
Unlike uiLanguages(), the value returned by bcp47Name() represents the locale name of the QLocale data; this need not be the language the user-interface should be in.
This function tries to conform the locale name to the IETF Best Common Practice 47, defined by RFC 5646. Since Qt 6.7, it supports an optional separator parameter which can be used to override the BCP47-specified use of a hyphen to separate the tags. For use in IETF-defined protocols, however, the default, QLocale::TagSeparator::Dash, should be retained.
Definition at line 1482 of file qlocale.cpp.
References badSeparatorWarning(), QLocalePrivate::bcp47Name(), QString::fromLatin1(), and sep.
Referenced by QQmlApplicationEnginePrivate::QQmlApplicationEnginePrivate().
|
inlinestatic |
Returns a QLocale object initialized to the "C" locale.
This locale is based on en_US but with various quirks of its own, such as simplified number formatting and its own date formatting. It implements the POSIX standards that describe the behavior of standard library functions of the "C" programming language.
Among other things, this means its collation order is based on the ASCII values of letters, so that (for case-sensitive sorting) all upper-case letters sort before any lower-case one (rather than each letter's upper- and lower-case forms sorting adjacent to one another, before the next letter's two forms).
Definition at line 1146 of file qlocale.h.
Referenced by QTimeZonePrivate::abbreviation(), QPSQLDriver::formatValue(), QNetworkHeadersPrivate::fromHttpDate(), QTextStreamPrivate::getNumber(), QTextStreamPrivate::getReal(), QInputMethod::locale(), QTextStreamPrivate::putNumber(), QNetworkHeadersPrivate::toHttpDate(), and QNetworkCookie::toRawForm().
|
staticnoexcept |
Returns the QLocale::Language enum corresponding to the two- or three-letter languageCode, as defined in the ISO 639 standards.
If specified, codeTypes selects which set of codes to consider for conversion. By default all codes known to Qt are considered. The codes are matched in the following order: ISO639Part1
, ISO639Part2B
, ISO639Part2T
, ISO639Part3
, LegacyLanguageCode
.
If the code is invalid or not known QLocale::AnyLanguage
is returned.
Definition at line 1530 of file qlocale.cpp.
References QLocalePrivate::codeToLanguage().
Referenced by QFFmpegMetaData::addEntry(), QT_BEGIN_NAMESPACE::addTagToMetaData(), AVFMetaData::fromAssetTrack(), and getLocaleLanguage().
|
staticnoexcept |
Returns the QLocale::Script enum corresponding to the four-letter script scriptCode, as defined in the ISO 15924 standard.
If the code is invalid or not known QLocale::AnyScript is returned.
Definition at line 1621 of file qlocale.cpp.
References QLocalePrivate::codeToScript().
|
staticnoexcept |
Returns the QLocale::Territory enum corresponding to the two-letter or three-digit territoryCode, as defined in the ISO 3166 standard.
If the code is invalid or not known QLocale::AnyTerritory is returned.
Definition at line 1561 of file qlocale.cpp.
References QLocalePrivate::codeToTerritory().
QLocale QLocale::collation | ( | ) | const |
Returns the locale to use for collation.
The result is usually this locale; however, the system locale (which is commonly the default locale) will return the system collation locale. The result is suitable for passing to QCollator's constructor.
Definition at line 4862 of file qlocale.cpp.
References QSystemLocale::Collation, d, systemLocale(), and systemLocaleData.
QString QLocale::createSeparatedList | ( | const QStringList & | list | ) | const |
Returns a string that represents a join of a given list of strings with a separator defined by the locale.
Definition at line 1246 of file qlocale.cpp.
References QStringView::arg(), QString::arg(), QList< T >::at(), QVariant::fromValue(), i, list, list_pattern_part_data, QSystemLocale::ListToSeparatedString, QLocalePrivate::m_data, QString, QList< T >::size(), systemLocale(), and systemLocaleData.
Referenced by QAndroidSystemLocale::query().
QString QLocale::currencySymbol | ( | CurrencySymbolFormat | format = CurrencySymbol | ) | const |
Definition at line 4548 of file qlocale.cpp.
References currency_display_name_data, currency_symbol_data, QSystemLocale::CurrencySymbol, d, QString::fromLatin1(), qstrnlen(), systemLocale(), and systemLocaleData.
Referenced by QAndroidSystemLocale::query().
QString QLocale::dateFormat | ( | FormatType | format = LongFormat | ) | const |
Returns the date format used for the current locale.
If format is LongFormat, the format will be elaborate, otherwise it will be short. For example, LongFormat for the {en_US} locale is
{dddd, MMMM d, yyyy}, ShortFormat is
{M/d/yy}.
Definition at line 2334 of file qlocale.cpp.
References date_format_data, QSystemLocale::DateFormatLong, QSystemLocale::DateFormatShort, getData(), LongFormat, QLocalePrivate::m_data, systemLocale(), and systemLocaleData.
Referenced by dateTimeFormat(), QAndroidSystemLocale::query(), QDateTimeEditPrivate::readLocaleSettings(), toString(), and toString().
QString QLocale::dateTimeFormat | ( | FormatType | format = LongFormat | ) | const |
Returns the date time format used for the current locale.
If format is LongFormat, the format will be elaborate, otherwise it will be short. For example, LongFormat for the {en_US} locale is
{dddd, MMMM d, yyyy h:mm:ss AP t}, ShortFormat is
{M/d/yy h:mm AP}.
Definition at line 2396 of file qlocale.cpp.
References dateFormat(), QSystemLocale::DateTimeFormatLong, QSystemLocale::DateTimeFormatShort, LongFormat, QLocalePrivate::m_data, systemLocale(), systemLocaleData, and timeFormat().
Referenced by QAndroidSystemLocale::query(), QDateTimeEditPrivate::readLocaleSettings(), toString(), and toString().
QString QLocale::dayName | ( | int | day, |
FormatType | type = LongFormat ) const |
Returns the localized name of the day (where 1 represents Monday, 2 represents Tuesday and so on), in the format specified by type.
For example, if the locale is en_US
and day is 1, \l LongFormat will return Monday
, \l ShortFormat Mon
, and \l NarrowFormat M
.
Definition at line 2997 of file qlocale.cpp.
References QCalendar::weekDayName().
Referenced by QAndroidSystemLocale::query(), and QtPrivate::QCalendarDayValidator::text().
QString QLocale::decimalPoint | ( | ) | const |
Returns the fractional part separator for this locale.
This is the token that separates the whole number part from the fracional part in the representation of a number which has a fractional part. This is commonly called the "decimal point character" - even though, in many locales, it is not a "point" (or similar dot). It is (since Qt 6.0) returned as a string in case some locale needs more than one UTF-16 code-point to represent its separator.
Definition at line 2655 of file qlocale.cpp.
References QLocaleData::decimalPoint(), and QLocalePrivate::m_data.
Referenced by QTextStreamPrivate::getReal(), QAndroidSystemLocale::query(), and QDoubleSpinBoxPrivate::validateAndInterpret().
QString QLocale::exponential | ( | ) | const |
Returns the exponent separator for this locale.
This is a token used to separate mantissa from exponent in some floating-point numeric representations. It is (since Qt 6.0) returned as a string because, in some locales, it is not a single character - for example, it may consist of a multiplication sign and a representation of the "ten to the power" operator.
Definition at line 2762 of file qlocale.cpp.
References QLocaleData::exponentSeparator(), and QLocalePrivate::m_data.
Referenced by QTextStreamPrivate::getReal().
Qt::DayOfWeek QLocale::firstDayOfWeek | ( | ) | const |
Returns the first day of the week according to the current locale.
Definition at line 3272 of file qlocale.cpp.
References QSystemLocale::FirstDayOfWeek, QLocalePrivate::m_data, QLocaleData::m_first_day_of_week, systemLocale(), and systemLocaleData.
Referenced by QQuickWeekNumberModelPrivate::init(), QQuickMonthModelPrivate::populate(), and QAndroidSystemLocale::query().
QString QLocale::formattedDataSize | ( | qint64 | bytes, |
int | precision = 2, | ||
DataSizeFormats | format = DataSizeIecFormat ) const |
Converts a size in bytes to a human-readable localized string, comprising a number and a quantified unit. The quantifier is chosen such that the number is at least one, and as small as possible. For example if bytes is 16384, precision is 2, and format is \l DataSizeIecFormat (the default), this function returns "16.00 KiB"; for 1330409069609 bytes it returns "1.21 GiB"; and so on. If format is \l DataSizeIecFormat or \l DataSizeTraditionalFormat, the given number of bytes is divided by a power of 1024, with result less than 1024; for \l DataSizeSIFormat, it is divided by a power of 1000, with result less than 1000. DataSizeIecFormat
uses the new IEC standard quantifiers Ki, Mi and so on, whereas DataSizeSIFormat
uses the older SI quantifiers k, M, etc., and DataSizeTraditionalFormat
abuses them.
Definition at line 4695 of file qlocale.cpp.
References base, byte_unit_data, d, number, Q_ASSERT, qAbs(), qCountLeadingZeroBits(), qMin(), and toString().
QString QLocale::groupSeparator | ( | ) | const |
Returns the digit-grouping separator for this locale.
This is a token used to break up long sequences of digits, in the representation of a number, to make it easier to read. In some locales it may be empty, indicating that digits should not be broken up into groups in this way. In others it may be a spacing character. It is (since Qt 6.0) returned as a string in case some locale needs more than one UTF-16 code-point to represent its separator.
Definition at line 2674 of file qlocale.cpp.
References QLocaleData::groupSeparator(), and QLocalePrivate::m_data.
Referenced by QTextStreamPrivate::getNumber(), QTextStreamPrivate::getReal(), QAndroidSystemLocale::query(), QSpinBoxPrivate::validateAndInterpret(), and QDoubleSpinBoxPrivate::validateAndInterpret().
QLocale::Language QLocale::language | ( | ) | const |
Returns the language of this locale.
Definition at line 1317 of file qlocale.cpp.
References QLocalePrivate::languageId().
Referenced by QWindowsInputContext::endComposition(), QCollatorPrivate::isC(), matchingLocales(), name(), and operator<<().
|
static |
Returns the two- or three-letter language code for language, as defined in the ISO 639 standards.
If specified, codeTypes selects which set of codes to consider. The first code from the set that is defined for language is returned. Otherwise, all ISO-639 codes are considered. The codes are considered in the following order: ISO639Part1
, ISO639Part2B
, ISO639Part2T
, ISO639Part3
. LegacyLanguageCode
is ignored by this function.
{QLocale::C} the function returns
{"C"}. For QLocale::AnyLanguage
an empty string is returned. If the language has no code in any selected code set, an empty string is returned.Definition at line 1510 of file qlocale.cpp.
References QString::data(), and QLocalePrivate::languageToCode().
Referenced by applyMetaDataToTagSetter(), setAVMetadataItemForKey(), and QFFmpegMetaData::value().
Returns a QString containing the name of language.
Definition at line 1632 of file qlocale.cpp.
References QString::fromUtf8(), language_name_index, language_name_list, and LastLanguage.
Referenced by operator<<(), and QMediaMetaData::stringValue().
|
static |
Returns a list of valid locale objects that match the given language, script and territory.
Getting a list of all locales: QList<QLocale> allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyTerritory);
Getting a list of locales suitable for Russia: QList<QLocale> locales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::Russia);
Definition at line 2893 of file qlocale.cpp.
References QLocale(), C, c_private(), language(), locale_data, locale_data_size, locale_index, QLocalePrivate, script(), system(), systemData(), and territory().
QLocale::MeasurementSystem QLocale::measurementSystem | ( | ) | const |
Returns the measurement system for the locale.
Definition at line 3326 of file qlocale.cpp.
References QLocalePrivate::m_data, QSystemLocale::MeasurementSystem, QLocalePrivate::measurementSystem(), systemLocale(), and systemLocaleData.
Referenced by QDeclarativeGeoRouteModel::measurementSystem(), and QGeoRoutingManagerEngine::setLocale().
QString QLocale::monthName | ( | int | month, |
FormatType | type = LongFormat ) const |
Returns the localized name of month, in the format specified by type.
For example, if the locale is en_US
and month is 1, \l LongFormat will return January
. \l ShortFormat Jan
, and \l NarrowFormat J
.
Definition at line 2963 of file qlocale.cpp.
References QCalendar::monthName(), and QCalendar::Unspecified.
Referenced by QAndroidSystemLocale::query().
QString QLocale::name | ( | TagSeparator | separator = TagSeparator::Underscore | ) | const |
The short name of this locale.
Returns the language and territory of this locale as a string of the form "language_territory", where language is a lowercase, two-letter ISO 639 language code, and territory is an uppercase, two- or three-letter ISO 3166 territory code. If the locale has no specified territory, only the language name is returned. Since Qt 6.7 an optional separator parameter can be supplied to override the default underscore character separating the two tags.
Even if the QLocale object was constructed with an explicit script, name() will not contain it for compatibility reasons. Use \l bcp47Name() instead if you need a full locale name, or construct the string you want to identify a locale by from those returned by passing its \l language() to \l languageToCode() and similar for the script and territory.
Definition at line 1412 of file qlocale.cpp.
References AnyTerritory, badSeparatorWarning(), C, QString::data(), language(), QLocalePrivate::languageCode(), sep, territory(), QLocalePrivate::territoryCode(), and view.
Referenced by operator<<(), and QFileSelectorPrivate::updateSelectors().
QString QLocale::nativeLanguageName | ( | ) | const |
Returns a native name of the language for the locale. For example "Schweizer Hochdeutsch" for the Swiss-German locale.
Definition at line 4882 of file qlocale.cpp.
References d, endonyms_data, QSystemLocale::NativeLanguageName, systemLocale(), and systemLocaleData.
QString QLocale::nativeTerritoryName | ( | ) | const |
Returns a native name of the territory for the locale. For example "España" for Spanish/Spain locale.
Definition at line 4902 of file qlocale.cpp.
References d, endonyms_data, QSystemLocale::NativeTerritoryName, systemLocale(), and systemLocaleData.
QString QLocale::negativeSign | ( | ) | const |
Returns the negative sign indicator of this locale.
This is a token presumed to be used as a prefix to a number to indicate that it is negative. It is (since Qt 6.0) returned as a string because, in some locales, it is not a single character - for example, because it includes a text-direction-control character.
Definition at line 2727 of file qlocale.cpp.
References QLocalePrivate::m_data, and QLocaleData::negativeSign().
Referenced by QTextStreamPrivate::getNumber(), QTextStreamPrivate::getReal(), QTextStreamPrivate::putNumber(), QTextStreamPrivate::putString(), QTextStreamPrivate::putString(), and QAndroidSystemLocale::query().
QLocale::NumberOptions QLocale::numberOptions | ( | ) | const |
Returns the options related to number conversions for this QLocale instance.
By default, no options are set for the standard locales, except for the "C" locale, which has OmitGroupSeparator set by default.
Definition at line 1193 of file qlocale.cpp.
References QLocalePrivate::m_numberOptions.
Referenced by QDoubleValidatorPrivate::fixupWithLocale(), QTextStreamPrivate::putNumber(), QProgressBar::text(), and QDoubleValidatorPrivate::validateWithLocale().
QString QLocale::percent | ( | ) | const |
Returns the percent marker of this locale.
This is a token presumed to be appended to a number to indicate a percentage. It is (since Qt 6.0) returned as a string because, in some locales, it is not a single character - for example, because it includes a text-direction-control character.
Definition at line 2691 of file qlocale.cpp.
References QLocalePrivate::m_data, and QLocaleData::percentSign().
Referenced by QProgressBarPrivate::initDefaultFormat().
QString QLocale::pmText | ( | ) | const |
Returns the localized name of the "PM" suffix for times specified using the conventions of the 12-hour clock.
Definition at line 3459 of file qlocale.cpp.
References QLocalePrivate::m_data, pm_data, QSystemLocale::PMText, systemLocale(), and systemLocaleData.
Referenced by QAndroidSystemLocale::query().
QString QLocale::positiveSign | ( | ) | const |
Returns the positive sign indicator of this locale.
This is a token presumed to be used as a prefix to a number to indicate that it is positive. It is (since Qt 6.0) returned as a string because, in some locales, it is not a single character - for example, because it includes a text-direction-control character.
Definition at line 2744 of file qlocale.cpp.
References QLocalePrivate::m_data, and QLocaleData::positiveSign().
Referenced by QTextStreamPrivate::getNumber(), QTextStreamPrivate::getReal(), QTextStreamPrivate::putString(), QTextStreamPrivate::putString(), and QAndroidSystemLocale::query().
|
inline |
Returns str quoted according to the current locale using the given quotation style.
Definition at line 1161 of file qlocale.h.
References str.
Referenced by QAndroidSystemLocale::query().
QString QLocale::quoteString | ( | QStringView | str, |
QuotationStyle | style = StandardQuotation ) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1212 of file qlocale.cpp.
References AlternateQuotation, QVariant::fromValue(), QLocalePrivate::m_data, single_character_data, StandardQuotation, str, QSystemLocale::StringToAlternateQuotation, QSystemLocale::StringToStandardQuotation, systemLocale(), and systemLocaleData.
QLocale::Script QLocale::script | ( | ) | const |
Returns the script of this locale.
Definition at line 1329 of file qlocale.cpp.
References QLocalePrivate::m_data.
Referenced by matchingLocales(), operator<<(), scriptToCode(), scriptToString(), textDirection(), and writingSystemFromLocale().
Returns the four-letter script code for script, as defined in the ISO 15924 standard.
{QLocale::AnyScript} an empty string is returned.Definition at line 1607 of file qlocale.cpp.
References script(), and QLocalePrivate::scriptToCode().
Returns a QString containing the name of script.
Definition at line 1674 of file qlocale.cpp.
References QString::fromUtf8(), LastScript, script(), script_name_index, and script_name_list.
Referenced by operator<<().
\nonreentrant
Sets the global default locale to locale. These values are used when a QLocale object is constructed with no arguments. If this function is not called, the system's locale is used.
Definition at line 1295 of file qlocale.cpp.
References default_data, Q_ASSERT, and QLocalePrivate::s_generation.
Referenced by Widget::argFunction().
void QLocale::setNumberOptions | ( | NumberOptions | options | ) |
Sets the options related to number conversions for this QLocale instance.
Definition at line 1177 of file qlocale.cpp.
References QLocalePrivate::m_numberOptions.
Referenced by QProgressBar::text().
QString QLocale::standaloneDayName | ( | int | day, |
FormatType | type = LongFormat ) const |
Returns the localized name of the day (where 1 represents Monday, 2 represents Tuesday and so on) that is used as a standalone text, in the format specified by type.
If the locale information does not specify the standalone day name then return value is the same as in dayName().
Definition at line 3014 of file qlocale.cpp.
References QCalendar::standaloneWeekDayName().
Referenced by QAndroidSystemLocale::query().
QString QLocale::standaloneMonthName | ( | int | month, |
FormatType | type = LongFormat ) const |
Returns the localized name of month that is used as a standalone text, in the format specified by type.
If the locale information doesn't specify the standalone month name then return value is the same as in monthName().
Definition at line 2979 of file qlocale.cpp.
References QCalendar::standaloneMonthName(), and QCalendar::Unspecified.
Referenced by QQuickMonthModelPrivate::populate(), and QAndroidSystemLocale::query().
|
static |
Returns a QLocale object initialized to the system locale.
The system locale may use system-specific sources for locale data, where available, otherwise falling back on QLocale's built-in database entry for the language, script and territory the system reports.
For example, on Windows and Mac, this locale will use the decimal/grouping characters and date/time formats specified in the system configuration panel.
Definition at line 2862 of file qlocale.cpp.
References QLocale(), DefaultNumberOptions, locale_data, locale_data_size, Q_ASSERT, systemData(), and systemLocaleData.
Referenced by QDateTimeParser::QDateTimeParser(), addFontToDatabase(), QCalendarBackend::dateTimeToString(), QAndroidPlatformFontDatabase::fallbacksForFamily(), MainWindow::insertCalendar(), QPlatformInputContext::locale(), makeAcceptLanguage(), matchingLocales(), printLocalizationInformation(), QFileSystemModelPrivate::size(), QFileSystemModelPrivate::time(), QGeoRouteParserOsrmV5ExtensionMapbox::updateQuery(), and writingSystemFromLocale().
QLocale::Territory QLocale::territory | ( | ) | const |
Returns the territory of this locale.
Definition at line 1341 of file qlocale.cpp.
References QLocalePrivate::territoryId().
Referenced by matchingLocales(), name(), operator<<(), territoryToCode(), and territoryToString().
|
static |
Returns the two-letter territory code for territory, as defined in the ISO 3166 standard.
{QLocale::AnyTerritory} an empty string is returned.Definition at line 1546 of file qlocale.cpp.
References territory(), and QLocalePrivate::territoryToCode().
Returns a QString containing the name of territory.
Definition at line 1646 of file qlocale.cpp.
References QString::fromUtf8(), LastTerritory, territory(), territory_name_index, and territory_name_list.
Referenced by operator<<().
Qt::LayoutDirection QLocale::textDirection | ( | ) | const |
Returns the text direction of the language.
Definition at line 3344 of file qlocale.cpp.
References AdlamScript, ArabicScript, AvestanScript, CypriotScript, HatranScript, HebrewScript, ImperialAramaicScript, InscriptionalPahlaviScript, InscriptionalParthianScript, KharoshthiScript, Qt::LeftToRight, LydianScript, MandaeanScript, ManichaeanScript, MendeKikakuiScript, MeroiticCursiveScript, MeroiticScript, NabataeanScript, NkoScript, OldHungarianScript, OldNorthArabianScript, OldSouthArabianScript, OrkhonScript, PalmyreneScript, PhoenicianScript, PsalterPahlaviScript, Qt::RightToLeft, SamaritanScript, script(), SyriacScript, and ThaanaScript.
Referenced by QDBusMenuAdaptor::textDirection().
QString QLocale::timeFormat | ( | FormatType | format = LongFormat | ) | const |
Returns the time format used for the current locale.
If format is LongFormat, the format will be elaborate, otherwise it will be short. For example, LongFormat for the {en_US} locale is
{h:mm:ss AP t}, ShortFormat is
{h:mm AP}.
Definition at line 2365 of file qlocale.cpp.
References getData(), LongFormat, QLocalePrivate::m_data, systemLocale(), systemLocaleData, time_format_data, QSystemLocale::TimeFormatLong, and QSystemLocale::TimeFormatShort.
Referenced by dateTimeFormat(), QAndroidSystemLocale::query(), QDateTimeEditPrivate::readLocaleSettings(), and toString().
QString QLocale::toCurrencyString | ( | double | value, |
const QString & | symbol = QString(), | ||
int | precision = -1 ) const |
Definition at line 4635 of file qlocale.cpp.
References arg, currency_format_data, QSystemLocale::CurrencyToString, d, QVariant::fromValue(), QString::isNull(), str, systemLocale(), systemLocaleData, and toString().
Returns a localized string representation of value as a currency. If the symbol is provided it is used instead of the default currency symbol.
Definition at line 4580 of file qlocale.cpp.
References arg, currency_format_data, QSystemLocale::CurrencyToString, d, QVariant::fromValue(), QString::isEmpty(), QString::isNull(), str, systemLocale(), systemLocaleData, and toString().
Referenced by QAndroidSystemLocale::query().
QString QLocale::toCurrencyString | ( | qulonglong | value, |
const QString & | symbol = QString() ) const |
Definition at line 4607 of file qlocale.cpp.
References arg, currency_format_data, QSystemLocale::CurrencyToString, d, QVariant::fromValue(), QString::isEmpty(), QString::isNull(), str, systemLocale(), systemLocaleData, and toString().
Returns the double represented by the localized string s.
Returns an infinity if the conversion overflows or 0.0 if the conversion fails for any other reason (e.g. underflow).
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
Notice that the last conversion returns 1234.0, because '.' is the thousands group separator in the German locale.
This function ignores leading and trailing whitespace.
Definition at line 969 of file qlocale.h.
References ok, qToStringViewIgnoringNull(), and toDouble().
Referenced by QTextStreamPrivate::getReal(), toFloat(), QDoubleSpinBoxPrivate::validateAndInterpret(), and QDoubleValidatorPrivate::validateWithLocale().
double QLocale::toDouble | ( | QStringView | s, |
bool * | ok = nullptr ) const |
Returns the double represented by the localized string s.
Returns an infinity if the conversion overflows or 0.0 if the conversion fails for any other reason (e.g. underflow).
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
Notice that the last conversion returns 1234.0, because '.' is the thousands group separator in the German locale.
This function ignores leading and trailing whitespace.
Definition at line 2041 of file qlocale.cpp.
References QLocalePrivate::m_data, QLocalePrivate::m_numberOptions, ok, and QLocaleData::stringToDouble().
Returns the float represented by the localized string s.
Returns an infinity if the conversion overflows or 0.0 if the conversion fails for any other reason (e.g. underflow).
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 967 of file qlocale.h.
References ok, and qToStringViewIgnoringNull().
float QLocale::toFloat | ( | QStringView | s, |
bool * | ok = nullptr ) const |
Returns the float represented by the localized string s.
Returns an infinity if the conversion overflows or 0.0 if the conversion fails for any other reason (e.g. underflow).
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 2015 of file qlocale.cpp.
References QLocaleData::convertDoubleToFloat(), ok, and toDouble().
Returns the int represented by the localized string s.
If the conversion fails the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 955 of file qlocale.h.
References ok, qToStringViewIgnoringNull(), and toInt().
Referenced by QQuickSpinBoxPrivate::evaluateValueFromText(), QIntValidator::validate(), and QSpinBoxPrivate::validateAndInterpret().
int QLocale::toInt | ( | QStringView | s, |
bool * | ok = nullptr ) const |
Returns the int represented by the localized string s.
If the conversion fails, the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 1893 of file qlocale.cpp.
References ok.
Returns the long int represented by the localized string s.
If the conversion fails the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 959 of file qlocale.h.
References ok, and qToStringViewIgnoringNull().
long QLocale::toLong | ( | QStringView | s, |
bool * | ok = nullptr ) const |
If the conversion fails the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 1932 of file qlocale.cpp.
References ok.
Returns the long long int represented by the localized string s.
If the conversion fails the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 963 of file qlocale.h.
References ok, and qToStringViewIgnoringNull().
qlonglong QLocale::toLongLong | ( | QStringView | s, |
bool * | ok = nullptr ) const |
Returns the long long int represented by the localized string s.
If the conversion fails, the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 1973 of file qlocale.cpp.
References ok.
Returns a lowercase copy of str.
If Qt Core is using the ICU libraries, they will be used to perform the transformation according to the rules of the current locale. Otherwise the conversion may be done in a platform-dependent manner, with QString::toLower() as a generic fallback.
Definition at line 3418 of file qlocale.cpp.
References QLocalePrivate::bcp47Name(), ok, str, and QString::toLower().
Returns the short int represented by the localized string s.
If the conversion fails the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 951 of file qlocale.h.
References ok, and qToStringViewIgnoringNull().
short QLocale::toShort | ( | QStringView | s, |
bool * | ok = nullptr ) const |
Returns the short int represented by the localized string s.
If the conversion fails, the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 1853 of file qlocale.cpp.
References ok.
Returns a localized string representation of the given dateTime according to the specified format. If format is an empty string, an empty string is returned.
Definition at line 998 of file qlocale.h.
References dateTime, qToStringViewIgnoringNull(), and toString().
QString QLocale::toString | ( | const QDateTime & | dateTime, |
FormatType | format, | ||
QCalendar | cal ) const |
Returns a localized string representation of the given dateTime according to the specified format (see dateTimeFormat()), optionally for a specified calendar cal.
Definition at line 2252 of file qlocale.cpp.
References dateTime, dateTimeFormat(), QSystemLocale::DateTimeToStringLong, QSystemLocale::DateTimeToStringShort, QDateTime::isValid(), LongFormat, QLocalePrivate::m_data, QString, systemLocale(), systemLocaleData, and toString().
QString QLocale::toString | ( | const QDateTime & | dateTime, |
FormatType | format = LongFormat ) const |
Definition at line 2276 of file qlocale.cpp.
References dateTime, dateTimeFormat(), QSystemLocale::DateTimeToStringLong, QSystemLocale::DateTimeToStringShort, QDateTime::isValid(), LongFormat, QLocalePrivate::m_data, QString, systemLocale(), systemLocaleData, and toString().
QString QLocale::toString | ( | const QDateTime & | dateTime, |
QStringView | format ) const |
Definition at line 2237 of file qlocale.cpp.
References dateTime, and QCalendar::dateTimeToString().
QString QLocale::toString | ( | const QDateTime & | dateTime, |
QStringView | format, | ||
QCalendar | cal ) const |
Returns a localized string representation of the given dateTime according to the specified format, optionally for a specified calendar cal. If format is an empty string, an empty string is returned.
Definition at line 2228 of file qlocale.cpp.
References dateTime.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a string representing the floating-point number f.
The form of the representation is controlled by the format and precision parameters.
The format defaults to {'g'}. It can be any of the following:
\table \header
'e'
'E'
'F'
'f'
except for INF and NAN (see below) The special precision value QLocale::FloatingPointShortest selects the shortest representation that, when read as a number, gets back the original floating-point value. Aside from that, any negative precision is ignored in favor of the default, 6.
For the 'e'
, 'f'
and 'g'
formats, positive infinity is represented as "inf", negative infinity as "-inf" and floating-point NaN (not-a-number) values are represented as "nan". For the 'E'
, 'F'
and 'G'
formats, "INF" and "NAN" are used instead. This does not vary with locale.
Definition at line 2801 of file qlocale.cpp.
References QLocaleData::AddTrailingZeroes, QLocaleData::CapitalEorX, QLocaleData::DFDecimal, QLocaleData::DFExponent, QLocaleData::DFSignificantDigits, QLocaleData::doubleToString(), form, QLocaleData::GroupDigits, IncludeTrailingZeroesAfterDot, QtMiscUtils::isAsciiUpper(), QLocalePrivate::m_data, QLocalePrivate::m_numberOptions, OmitGroupSeparator, OmitLeadingZeroInExponent, QtMiscUtils::toAsciiLower(), and QLocaleData::ZeroPadExponent.
Definition at line 992 of file qlocale.h.
References toString().
|
inline |
Definition at line 989 of file qlocale.h.
References i, and toString().
Referenced by toString().
|
inline |
Definition at line 985 of file qlocale.h.
References i, and toString().
Referenced by toString().
Returns a localized string representation of the given date in the specified format.
If format is an empty string, an empty string is returned.
Definition at line 2082 of file qlocale.cpp.
References date, qToStringViewIgnoringNull(), and toString().
QString QLocale::toString | ( | QDate | date, |
FormatType | format, | ||
QCalendar | cal ) const |
Returns a localized string representation of the given date according to the specified format (see dateFormat()), optionally for a specified calendar cal.
Definition at line 2144 of file qlocale.cpp.
References date, dateFormat(), QSystemLocale::DateToStringLong, QSystemLocale::DateToStringShort, QDate::isValid(), LongFormat, QLocalePrivate::m_data, QString, systemLocale(), systemLocaleData, and toString().
QString QLocale::toString | ( | QDate | date, |
FormatType | format = LongFormat ) const |
Definition at line 2168 of file qlocale.cpp.
References date, dateFormat(), QSystemLocale::DateToStringLong, QSystemLocale::DateToStringShort, QDate::isValid(), LongFormat, QLocalePrivate::m_data, QString, systemLocale(), systemLocaleData, and toString().
QString QLocale::toString | ( | QDate | date, |
QStringView | format ) const |
Definition at line 2129 of file qlocale.cpp.
References date, and QCalendar::dateTimeToString().
QString QLocale::toString | ( | QDate | date, |
QStringView | format, | ||
QCalendar | cal ) const |
Returns a localized string representation of the given date in the specified format, optionally for a specified calendar cal. If format is an empty string, an empty string is returned.
Definition at line 2120 of file qlocale.cpp.
References date.
Returns a localized string representation of i.
Definition at line 2052 of file qlocale.cpp.
References QLocaleData::GroupDigits, i, QLocaleData::longLongToString(), QLocalePrivate::m_data, QLocalePrivate::m_numberOptions, and OmitGroupSeparator.
Referenced by QQuickSpinBoxPrivate::evaluateTextFromValue(), QIntValidator::fixup(), QDoubleValidatorPrivate::fixupWithLocale(), QAndroidSystemLocale::query(), QProgressBar::text(), QDateTimeEdit::textFromDateTime(), QDoubleSpinBox::textFromValue(), QSpinBox::textFromValue(), ToLocaleDateString(), ToLocaleString(), ToLocaleTimeString(), toString(), toString(), toString(), toString(), toString(), toString(), and toString().
Returns a localized string representation of the given time according to the specified format.
If format is an empty string, an empty string is returned.
Definition at line 2095 of file qlocale.cpp.
References qToStringViewIgnoringNull(), time, and toString().
QString QLocale::toString | ( | QTime | time, |
FormatType | format = LongFormat ) const |
Returns a localized string representation of the given time in the specified format (see timeFormat()).
Definition at line 2302 of file qlocale.cpp.
References QTime::isValid(), LongFormat, QLocalePrivate::m_data, QString, systemLocale(), systemLocaleData, time, timeFormat(), QSystemLocale::TimeToStringLong, QSystemLocale::TimeToStringShort, and toString().
QString QLocale::toString | ( | QTime | time, |
QStringView | format ) const |
Returns a localized string representation of the given time according to the specified format. If format is an empty string, an empty string is returned.
Definition at line 2214 of file qlocale.cpp.
References QCalendar::dateTimeToString(), and time.
QString QLocale::toString | ( | qulonglong | i | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 2066 of file qlocale.cpp.
References QLocaleData::GroupDigits, i, QLocalePrivate::m_data, QLocalePrivate::m_numberOptions, OmitGroupSeparator, and QLocaleData::unsLongLongToString().
|
inline |
Definition at line 987 of file qlocale.h.
References i, and toString().
Referenced by toString().
Definition at line 990 of file qlocale.h.
References i, and toString().
Referenced by toString().
Definition at line 986 of file qlocale.h.
References i, and toString().
Referenced by toString().
Definition at line 988 of file qlocale.h.
References i, and toString().
Referenced by toString().
Returns the unsigned int represented by the localized string s.
If the conversion fails the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 957 of file qlocale.h.
References ok, and qToStringViewIgnoringNull().
uint QLocale::toUInt | ( | QStringView | s, |
bool * | ok = nullptr ) const |
Returns the unsigned int represented by the localized string s.
If the conversion fails, the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 1913 of file qlocale.cpp.
References ok.
Returns the unsigned long int represented by the localized string s.
If the conversion fails the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 961 of file qlocale.h.
References ok, and qToStringViewIgnoringNull().
ulong QLocale::toULong | ( | QStringView | s, |
bool * | ok = nullptr ) const |
If the conversion fails the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 1952 of file qlocale.cpp.
References ok.
|
inline |
Returns the unsigned long long int represented by the localized string s.
If the conversion fails the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 965 of file qlocale.h.
References ok, and qToStringViewIgnoringNull().
qulonglong QLocale::toULongLong | ( | QStringView | s, |
bool * | ok = nullptr ) const |
Returns the unsigned long long int represented by the localized string s.
If the conversion fails, the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 1994 of file qlocale.cpp.
References ok.
Returns an uppercase copy of str.
If Qt Core is using the ICU libraries, they will be used to perform the transformation according to the rules of the current locale. Otherwise the conversion may be done in a platform-dependent manner, with QString::toUpper() as a generic fallback.
Definition at line 3394 of file qlocale.cpp.
References QLocalePrivate::bcp47Name(), ok, str, and QString::toUpper().
Returns the unsigned short int represented by the localized string s.
If the conversion fails the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 953 of file qlocale.h.
References ok, and qToStringViewIgnoringNull().
ushort QLocale::toUShort | ( | QStringView | s, |
bool * | ok = nullptr ) const |
Returns the unsigned short int represented by the localized string s.
If the conversion fails, the function returns 0.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
This function ignores leading and trailing whitespace.
Definition at line 1873 of file qlocale.cpp.
References ok.
QStringList QLocale::uiLanguages | ( | TagSeparator | separator = TagSeparator::Dash | ) | const |
List of locale names for use in selecting translations.
Each entry in the returned list is the name of a locale suitable to the user's preferences for what to translate the UI into. Where a name in the list is composed of several tags, they are joined as indicated by separator. Prior to Qt 6.7 a dash was used as separator.
For example, using the default separator QLocale::TagSeparator::Dash, if the user has configured their system to use English as used in the USA, the list would be "en-Latn-US", "en-US", "en". The order of entries is the order in which to check for translations; earlier items in the list are to be preferred over later ones. If your translation files use underscores, rather than dashes, to separate locale tags, pass QLocale::TagSeparator::Underscore as separator.
Most likely you do not need to use this function directly, but just pass the QLocale object to the QTranslator::load() function.
Definition at line 4748 of file qlocale.cpp.
References badSeparatorWarning(), d, QString::fromLatin1(), QLocaleId::fromName(), i, j, QLocaleId::name(), Q_ASSERT, sep, systemLocale(), systemLocaleData, QLocaleId::territory_id, QSystemLocale::UILanguages, QLocaleId::withLikelySubtagsAdded(), and QLocaleId::withLikelySubtagsRemoved().
Referenced by QMimeType::comment().
QList< Qt::DayOfWeek > QLocale::weekdays | ( | ) | const |
Returns a list of days that are considered weekdays according to the current locale.
Definition at line 3300 of file qlocale.cpp.
References QLocalePrivate::m_data, QLocaleData::m_weekend_end, QLocaleData::m_weekend_start, Qt::Monday, Qt::Sunday, systemLocale(), systemLocaleData, weekdays(), and QSystemLocale::Weekdays.
Referenced by weekdays().
QString QLocale::zeroDigit | ( | ) | const |
Returns the zero digit character of this locale.
This is a single Unicode character but may be encoded as a surrogate pair, so is (since Qt 6.0) returned as a string. In most locales, other digits follow it in Unicode ordering - however, some number systems, notably those using U+3007 as zero, do not have contiguous digits. Use toString() to obtain suitable representations of numbers, rather than trying to construct them from this zero digit.
Definition at line 2710 of file qlocale.cpp.
References QLocalePrivate::m_data, and QLocaleData::zeroDigit().
Referenced by QAndroidSystemLocale::query().
|
friend |
|
friend |
|
friend |
|
related |
Returns the hash value for key, using seed to seed the calculation.
Definition at line 1164 of file qlocale.cpp.
|
friend |
Returns the hash value for key, using seed to seed the calculation.
Definition at line 1164 of file qlocale.cpp.
|
friend |
|
friend |
Definition at line 1170 of file qlocale.h.
Referenced by matchingLocales().
|
friend |
|
friend |
Definition at line 31 of file qlocale.h.
Referenced by createSeparatedList(), toString(), toString(), toString(), toString(), and toString().
|
friend |
|
friend |
|
friend |
|
staticconstexpr |