![]() |
Qt 6.x
The Qt SDK
|
#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) | |
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 () const |
The short name of this locale. | |
QString | bcp47Name () 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 () 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. | |
Friends | |
class | QString |
class | QByteArray |
class | QIntValidator |
class | QDoubleValidatorPrivate |
class | QTextStream |
class | QTextStreamPrivate |
class | QLocalePrivate |
class | QSystemLocale |
class | QCalendarBackend |
class | QGregorianCalendar |
Q_CORE_EXPORT size_t | qHash (const QLocale &key, size_t seed) noexcept |
bool | operator== (const QLocale &lhs, const QLocale &rhs) |
bool | operator!= (const QLocale &lhs, const QLocale &rhs) |
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 |
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 1032 of file qlocale.cpp.
References systemData().
Referenced by collation(), 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 |
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 1013 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 1051 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 1075 of file qlocale.cpp.
|
defaultnoexcept |
Constructs a QLocale object as a copy of other.
QLocale::~QLocale | ( | ) |
Destructor.
Definition at line 1090 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 3299 of file qlocale.cpp.
References am_data, QSystemLocale::AMText, QLocalePrivate::m_data, QSystemLocale::query(), systemLocale(), systemLocaleData, and QVariant::toString().
Referenced by QAndroidSystemLocale::query().
QString QLocale::bcp47Name | ( | ) | 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 BCP47.
Definition at line 1397 of file qlocale.cpp.
References QLocalePrivate::bcp47Name(), and QString::fromLatin1().
Referenced by QQmlApplicationEnginePrivate::QQmlApplicationEnginePrivate(), and uiLanguages().
|
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 1103 of file qlocale.h.
Referenced by 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 1440 of file qlocale.cpp.
References QLocalePrivate::codeToLanguage().
Referenced by QFFmpegMetaData::addEntry(), addTagToMap(), 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 1531 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 1471 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 4689 of file qlocale.cpp.
References QLocale(), QSystemLocale::Collation, QLocalePrivate::m_data, QSystemLocale::query(), systemLocale(), systemLocaleData, and QVariant::toString().
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 1208 of file qlocale.cpp.
References QStringView::arg(), QList< T >::at(), QVariant::fromValue(), i, list, list_pattern_part_data, QSystemLocale::ListToSeparatedString, QLocalePrivate::m_data, QString, QSystemLocale::query(), QList< T >::size(), systemLocale(), systemLocaleData, and QVariant::toString().
Referenced by QAndroidSystemLocale::query().
QString QLocale::currencySymbol | ( | QLocale::CurrencySymbolFormat | format = CurrencySymbol | ) | const |
Definition at line 4386 of file qlocale.cpp.
References currency_display_name_data, currency_symbol_data, CurrencyDisplayName, CurrencyIsoCode, CurrencySymbol, QSystemLocale::CurrencySymbol, QString::fromLatin1(), QLocalePrivate::m_data, QString, qstrnlen(), QSystemLocale::query(), systemLocale(), systemLocaleData, and QVariant::toString().
Referenced by QAndroidSystemLocale::query(), toCurrencyString(), toCurrencyString(), and toCurrencyString().
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 2244 of file qlocale.cpp.
References date_format_data, QSystemLocale::DateFormatLong, QSystemLocale::DateFormatShort, getData(), LongFormat, QLocalePrivate::m_data, QSystemLocale::query(), systemLocale(), systemLocaleData, and QVariant::toString().
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 2306 of file qlocale.cpp.
References dateFormat(), QSystemLocale::DateTimeFormatLong, QSystemLocale::DateTimeFormatShort, LongFormat, QLocalePrivate::m_data, QSystemLocale::query(), systemLocale(), systemLocaleData, timeFormat(), and QVariant::toString().
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 2867 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 2535 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 2642 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 3132 of file qlocale.cpp.
References QSystemLocale::FirstDayOfWeek, QLocalePrivate::m_data, QLocaleData::m_first_day_of_week, QSystemLocale::query(), 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 4533 of file qlocale.cpp.
References base, byte_unit_data, DataSizeBase1000, DataSizeSIQuantifiers, QLocalePrivate::m_data, number, Q_ASSERT, qAbs(), qCountLeadingZeroBits(), qMin(), and toString().
Referenced by QFileSystemModelPrivate::size().
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 2554 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 1279 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 1420 of file qlocale.cpp.
References QString::data(), and QLocalePrivate::languageToCode().
Referenced by setAVMetadataItemForKey(), QGstreamerMetaData::setMetaData(), and QFFmpegMetaData::value().
Returns a QString containing the name of language.
Definition at line 1542 of file qlocale.cpp.
References 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 2762 of file qlocale.cpp.
References QLocale(), C, c_private(), QLocaleData::id(), 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 3186 of file qlocale.cpp.
References QLocalePrivate::m_data, QSystemLocale::MeasurementSystem, QLocalePrivate::measurementSystem(), QSystemLocale::query(), systemLocale(), and systemLocaleData.
Referenced by QDeclarativeGeoRouteModel::measurementSystem(), QGeoRoutingManagerEngine::setLocale(), and QGeoRouteParserOsrmV5ExtensionMapbox::updateQuery().
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 2833 of file qlocale.cpp.
References QCalendar::monthName(), and QCalendar::Unspecified.
Referenced by QAndroidSystemLocale::query().
QString QLocale::name | ( | ) | 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.
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 1340 of file qlocale.cpp.
References AnyTerritory, C, QString::data(), language(), QLocalePrivate::languageCode(), territory(), QLocalePrivate::territoryCode(), and view.
Referenced by QMimeType::comment(), operator<<(), QHttpNetworkConnectionPrivate::prepareRequest(), uiLanguages(), 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 4709 of file qlocale.cpp.
References endonyms_data, QLocalePrivate::m_data, QSystemLocale::NativeLanguageName, QSystemLocale::query(), systemLocale(), systemLocaleData, and QVariant::toString().
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 4729 of file qlocale.cpp.
References endonyms_data, QLocalePrivate::m_data, QSystemLocale::NativeTerritoryName, QSystemLocale::query(), systemLocale(), systemLocaleData, and QVariant::toString().
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 2607 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 1155 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 2571 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 3319 of file qlocale.cpp.
References QLocalePrivate::m_data, pm_data, QSystemLocale::PMText, QSystemLocale::query(), systemLocale(), systemLocaleData, and QVariant::toString().
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 2624 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 1117 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 1174 of file qlocale.cpp.
References AlternateQuotation, QVariant::fromValue(), QLocalePrivate::m_data, QSystemLocale::query(), single_character_data, StandardQuotation, str, QSystemLocale::StringToAlternateQuotation, QSystemLocale::StringToStandardQuotation, systemLocale(), systemLocaleData, and QVariant::toString().
QLocale::Script QLocale::script | ( | ) | const |
Returns the script of this locale.
Definition at line 1291 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 1517 of file qlocale.cpp.
References script(), and QLocalePrivate::scriptToCode().
|
static |
Returns a QString containing the name of script.
Definition at line 1584 of file qlocale.cpp.
References 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 1257 of file qlocale.cpp.
References default_data, QBasicAtomicInteger< T >::fetchAndAddRelaxed(), 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 1139 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 2884 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 2849 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 2742 of file qlocale.cpp.
References QLocale(), defaultIndex(), DefaultNumberOptions, QT_PREPEND_NAMESPACE(), and systemData().
Referenced by QDateTimeParser::QDateTimeParser(), QKeyMapperPrivate::QKeyMapperPrivate(), addFontToDatabase(), MainWindow::insertCalendar(), matchingLocales(), QHttpNetworkConnectionPrivate::prepareRequest(), printLocalizationInformation(), QFileSystemModelPrivate::size(), QFileSystemModelPrivate::time(), QGeoRouteParserOsrmV5ExtensionMapbox::updateQuery(), and writingSystemFromLocale().
QLocale::Territory QLocale::territory | ( | ) | const |
Returns the territory of this locale.
Definition at line 1303 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 1456 of file qlocale.cpp.
References territory(), and QLocalePrivate::territoryToCode().
|
static |
Returns a QString containing the name of territory.
Definition at line 1556 of file qlocale.cpp.
References 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 3204 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 QKeyMapperPrivate::QKeyMapperPrivate(), and 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 2275 of file qlocale.cpp.
References getData(), LongFormat, QLocalePrivate::m_data, QSystemLocale::query(), systemLocale(), systemLocaleData, time_format_data, QSystemLocale::TimeFormatLong, QSystemLocale::TimeFormatShort, and QVariant::toString().
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 4473 of file qlocale.cpp.
References arg, currency_format_data, CurrencyIsoCode, currencySymbol(), QSystemLocale::CurrencyToString, QVariant::fromValue(), QString::isNull(), QLocaleData::m_currency_digits, QLocalePrivate::m_data, QSystemLocale::query(), str, systemLocale(), systemLocaleData, QVariant::toString(), 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 4418 of file qlocale.cpp.
References arg, currency_format_data, CurrencyIsoCode, currencySymbol(), QSystemLocale::CurrencyToString, QVariant::fromValue(), QString::isEmpty(), QString::isNull(), QLocalePrivate::m_data, QSystemLocale::query(), str, systemLocale(), systemLocaleData, QVariant::toString(), and toString().
Referenced by QAndroidSystemLocale::query().
QString QLocale::toCurrencyString | ( | qulonglong | value, |
const QString & | symbol = QString() |
||
) | const |
Definition at line 4445 of file qlocale.cpp.
References arg, currency_format_data, CurrencyIsoCode, currencySymbol(), QSystemLocale::CurrencyToString, QVariant::fromValue(), QString::isEmpty(), QString::isNull(), QLocalePrivate::m_data, QSystemLocale::query(), str, systemLocale(), systemLocaleData, QVariant::toString(), 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 950 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 1951 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 948 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 1925 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 936 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 1803 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 940 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 1842 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 944 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 1883 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 3278 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 932 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 1763 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 979 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 2162 of file qlocale.cpp.
References dateTime, dateTimeFormat(), QSystemLocale::DateTimeToStringLong, QSystemLocale::DateTimeToStringShort, QCalendar::isGregorian(), QDateTime::isValid(), LongFormat, QLocalePrivate::m_data, QString, QSystemLocale::query(), systemLocale(), systemLocaleData, QVariant::toString(), and toString().
QString QLocale::toString | ( | const QDateTime & | dateTime, |
FormatType | format = LongFormat |
||
) | const |
Definition at line 2186 of file qlocale.cpp.
References dateTime, dateTimeFormat(), QSystemLocale::DateTimeToStringLong, QSystemLocale::DateTimeToStringShort, QDateTime::isValid(), LongFormat, QLocalePrivate::m_data, QString, QSystemLocale::query(), systemLocale(), systemLocaleData, QVariant::toString(), and toString().
QString QLocale::toString | ( | const QDateTime & | dateTime, |
QStringView | format | ||
) | const |
Definition at line 2147 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 2138 of file qlocale.cpp.
References dateTime, and QCalendar::dateTimeToString().
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 2681 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 973 of file qlocale.h.
References toString().
|
inline |
Definition at line 970 of file qlocale.h.
References i, and toString().
Referenced by toString().
|
inline |
Definition at line 966 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 1992 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 2054 of file qlocale.cpp.
References date, dateFormat(), QSystemLocale::DateToStringLong, QSystemLocale::DateToStringShort, QCalendar::isGregorian(), QDate::isValid(), LongFormat, QLocalePrivate::m_data, QString, QSystemLocale::query(), systemLocale(), systemLocaleData, QVariant::toString(), and toString().
QString QLocale::toString | ( | QDate | date, |
FormatType | format = LongFormat |
||
) | const |
Definition at line 2078 of file qlocale.cpp.
References date, dateFormat(), QSystemLocale::DateToStringLong, QSystemLocale::DateToStringShort, QDate::isValid(), LongFormat, QLocalePrivate::m_data, QString, QSystemLocale::query(), systemLocale(), systemLocaleData, QVariant::toString(), and toString().
QString QLocale::toString | ( | QDate | date, |
QStringView | format | ||
) | const |
Definition at line 2039 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 2030 of file qlocale.cpp.
References date, and QCalendar::dateTimeToString().
Returns a localized string representation of i.
Definition at line 1962 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(), formattedDataSize(), QPSQLDriver::formatValue(), QV4::NumberPrototype::method_toExponential(), QV4::NumberPrototype::method_toFixed(), QV4::NumberPrototype::method_toPrecision(), QAndroidSystemLocale::query(), QProgressBar::text(), QDateTimeEdit::textFromDateTime(), QDoubleSpinBox::textFromValue(), QSpinBox::textFromValue(), QFileSystemModelPrivate::time(), toCurrencyString(), toCurrencyString(), toCurrencyString(), QNetworkHeadersPrivate::toHttpDate(), ToLocaleDateString(), ToLocaleString(), ToLocaleTimeString(), QNetworkCookie::toRawForm(), 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 2005 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 2212 of file qlocale.cpp.
References QTime::isValid(), LongFormat, QLocalePrivate::m_data, QString, QSystemLocale::query(), systemLocale(), systemLocaleData, time, timeFormat(), QSystemLocale::TimeToStringLong, QSystemLocale::TimeToStringShort, QVariant::toString(), 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 2124 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 1976 of file qlocale.cpp.
References QLocaleData::GroupDigits, i, QLocalePrivate::m_data, QLocalePrivate::m_numberOptions, OmitGroupSeparator, and QLocaleData::unsLongLongToString().
|
inline |
Definition at line 968 of file qlocale.h.
References i, and toString().
Referenced by toString().
Definition at line 971 of file qlocale.h.
References i, and toString().
Referenced by toString().
Definition at line 967 of file qlocale.h.
References i, and toString().
Referenced by toString().
Definition at line 969 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 938 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 1823 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 942 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 1862 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 946 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 1904 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 3254 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 934 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 1783 of file qlocale.cpp.
References ok.
QStringList QLocale::uiLanguages | ( | ) | const |
List of locale names for use in selecting translations.
Each entry in the returned list is the dash-joined name of a locale, suitable to the user's preferences for what to translate the UI into. For example, 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.
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 4580 of file qlocale.cpp.
References QList< T >::append(), QList< T >::at(), bcp47Name(), C, QSystemLocale::fallbackLocale(), QString::fromLatin1(), QLocaleId::fromName(), i, QLocaleData::id(), QList< T >::isEmpty(), j, QLocalePrivate::m_data, name(), QLocaleId::name(), QList< T >::prepend(), Q_ASSERT, QSystemLocale::query(), QList< T >::size(), systemLocale(), systemLocaleData, QLocaleId::territory_id, QVariant::toStringList(), uiLanguages(), QSystemLocale::UILanguages, QLocaleId::withLikelySubtagsAdded(), and QLocaleId::withLikelySubtagsRemoved().
Referenced by QMimeType::comment(), printLocalizationInformation(), uiLanguages(), and writingSystemFromLocale().
QList< Qt::DayOfWeek > QLocale::weekdays | ( | ) | const |
Returns a list of days that are considered weekdays according to the current locale.
Definition at line 3160 of file qlocale.cpp.
References QLocalePrivate::m_data, QLocaleData::m_weekend_end, QLocaleData::m_weekend_start, Qt::Monday, QSystemLocale::query(), 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 2590 of file qlocale.cpp.
References QLocalePrivate::m_data, and QLocaleData::zeroDigit().
Referenced by QAndroidSystemLocale::query().
|
friend |
|
friend |
|
friend |
|
friend |
|
related |
Returns the hash value for key, using seed to seed the calculation.
Definition at line 1126 of file qlocale.cpp.
|
friend |
Returns the hash value for key, using seed to seed the calculation.
Definition at line 1126 of file qlocale.cpp.
|
friend |
|
friend |
Definition at line 1126 of file qlocale.h.
Referenced by matchingLocales().
|
friend |
Definition at line 31 of file qlocale.h.
Referenced by createSeparatedList(), currencySymbol(), toString(), toString(), toString(), toString(), and toString().
|
friend |
|
friend |
|
friend |