QLocale 類在各種語言的數字及其字符串錶示之間轉換。 更多...
| 頭: |
#include <QLocale>
|
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
|
| qmake: |
QT += core
|
此類 相等可比較 .
注意: 此類的所有函數 可重入 除以下外:
| enum | Country { AnyCountry, AnyTerritory, Afghanistan, AlandIslands, Albania, …, Zimbabwe } |
| enum | CurrencySymbolFormat { CurrencyIsoCode, CurrencySymbol, CurrencyDisplayName } |
| enum | DataSizeFormat { DataSizeIecFormat, DataSizeTraditionalFormat, DataSizeSIFormat } |
| flags | DataSizeFormats |
| enum | FloatingPointPrecisionOption { FloatingPointShortest } |
| enum | FormatType { LongFormat, ShortFormat, NarrowFormat } |
| enum | Language { AnyLanguage, C, Abkhazian, Afan, Afar, …, Zulu } |
| enum | LanguageCodeType { ISO639Part1, ISO639Part2B, ISO639Part2T, ISO639Part3, LegacyLanguageCode, …, AnyLanguageCode } |
| flags | LanguageCodeTypes |
| enum | MeasurementSystem { MetricSystem, ImperialUSSystem, ImperialUKSystem, ImperialSystem } |
| enum | NumberOption { DefaultNumberOptions, OmitGroupSeparator, RejectGroupSeparator, OmitLeadingZeroInExponent, RejectLeadingZeroInExponent, …, RejectTrailingZeroesAfterDot } |
| flags | NumberOptions |
| enum | QuotationStyle { StandardQuotation, AlternateQuotation } |
| enum | Script { AnyScript, AdlamScript, AhomScript, AnatolianHieroglyphsScript, ArabicScript, …, YiScript } |
(從 6.7 起)
枚舉類
|
TagSeparator { Dash, Underscore } |
| Territory |
| QLocale () | |
(從 6.3 起)
|
QLocale (QStringView name ) |
| QLocale (QLocale::Language 語言 , QLocale::Territory territory ) | |
| QLocale (QLocale::Language 語言 , QLocale::Script script = AnyScript, QLocale::Territory territory = AnyTerritory) | |
| QLocale (const QString & name ) | |
| QLocale (const QLocale & other ) | |
| ~QLocale () | |
| QString | amText () const |
| QString | bcp47Name (QLocale::TagSeparator separator = TagSeparator::Dash) const |
| QLocale | collation () const |
| QString | createSeparatedList (const QStringList & list ) const |
| QString | currencySymbol (QLocale::CurrencySymbolFormat format = CurrencySymbol) const |
| QString | dateFormat (QLocale::FormatType format = LongFormat) const |
| QString | dateTimeFormat (QLocale::FormatType format = LongFormat) const |
| QString | dayName (int day , QLocale::FormatType type = LongFormat) const |
| QString | decimalPoint () const |
| QString | exponential () const |
| Qt::DayOfWeek | firstDayOfWeek () const |
| QString | formattedDataSize (qint64 bytes , int precision = 2, QLocale::DataSizeFormats format = DataSizeIecFormat) const |
| QString | groupSeparator () const |
| QLocale::Language | language () const |
| QLocale::MeasurementSystem | measurementSystem () const |
| QString | monthName (int month , QLocale::FormatType type = LongFormat) const |
| QString | name (QLocale::TagSeparator separator = TagSeparator::Underscore) const |
| QString | nativeLanguageName () const |
(從 6.2 起)
QString
|
nativeTerritoryName () const |
| QString | negativeSign () const |
| QLocale::NumberOptions | numberOptions () const |
| QString | percent () const |
| QString | pmText () const |
| QString | positiveSign () const |
| QString | quoteString (const QString & str , QLocale::QuotationStyle style = StandardQuotation) const |
(從 6.0 起)
QString
|
quoteString (QStringView str , QLocale::QuotationStyle style = StandardQuotation) const |
| QLocale::Script | script () const |
| void | setNumberOptions (QLocale::NumberOptions options ) |
| QString | standaloneDayName (int day , QLocale::FormatType type = LongFormat) const |
| QString | standaloneMonthName (int month , QLocale::FormatType type = LongFormat) const |
| void | swap (QLocale & other ) |
(從 6.2 起)
QLocale::Territory
|
territory () const |
| Qt::LayoutDirection | textDirection () const |
| QString | timeFormat (QLocale::FormatType format = LongFormat) const |
| QString | toCurrencyString (qlonglong value , const QString & symbol = QString()) const |
| QString | toCurrencyString (int value , const QString & symbol = QString()) const |
| QString | toCurrencyString (qulonglong value , const QString & symbol = QString()) const |
| QString | toCurrencyString (short value , const QString & symbol = QString()) const |
| QString | toCurrencyString (uint value , const QString & symbol = QString()) const |
| QString | toCurrencyString (ushort value , const QString & symbol = QString()) const |
| QString | toCurrencyString (double value , const QString & symbol = QString(), int precision = -1) const |
| QString | toCurrencyString (float i , const QString & symbol = QString(), int precision = -1) const |
| QDate | toDate (const QString & string , QLocale::FormatType format = LongFormat, int baseYear = DefaultTwoDigitBaseYear) const |
| QDate | toDate (const QString & string , const QString & format , int baseYear = DefaultTwoDigitBaseYear) const |
| QDate | toDate (const QString & string , QLocale::FormatType format , QCalendar cal , int baseYear = DefaultTwoDigitBaseYear) const |
| QDate | toDate (const QString & string , const QString & format , QCalendar cal , int baseYear = DefaultTwoDigitBaseYear) const |
| QDateTime | toDateTime (const QString & string , QLocale::FormatType format = LongFormat, int baseYear = DefaultTwoDigitBaseYear) const |
| QDateTime | toDateTime (const QString & string , const QString & format , int baseYear = DefaultTwoDigitBaseYear) const |
| QDateTime | toDateTime (const QString & string , QLocale::FormatType format , QCalendar cal , int baseYear = DefaultTwoDigitBaseYear) const |
| QDateTime | toDateTime (const QString & string , const QString & format , QCalendar cal , int baseYear = DefaultTwoDigitBaseYear) const |
| double | toDouble (QStringView s , bool * ok = nullptr) const |
| double | toDouble (const QString & s , bool * ok = nullptr) const |
| float | toFloat (QStringView s , bool * ok = nullptr) const |
| float | toFloat (const QString & s , bool * ok = nullptr) const |
| int | toInt (QStringView s , bool * ok = nullptr) const |
| int | toInt (const QString & s , bool * ok = nullptr) const |
| long | toLong (QStringView s , bool * ok = nullptr) const |
| long | toLong (const QString & s , bool * ok = nullptr) const |
| qlonglong | toLongLong (QStringView s , bool * ok = nullptr) const |
| qlonglong | toLongLong (const QString & s , bool * ok = nullptr) const |
| QString | toLower (const QString & str ) const |
| short | toShort (QStringView s , bool * ok = nullptr) const |
| short | toShort (const QString & s , bool * ok = nullptr) const |
| QString | toString (qlonglong i ) const |
| QString | toString (QDate date , const QString & format ) const |
| QString | toString (QTime time , QLocale::FormatType format = LongFormat) const |
| QString | toString (QTime time , QStringView format ) const |
| QString | toString (QTime time , const QString & format ) const |
| QString | toString (const QDateTime & dateTime , const QString & format ) const |
| QString | toString (QDate date , QLocale::FormatType format , QCalendar cal ) const |
| QString | toString (QDate date , QStringView format , QCalendar cal ) const |
| QString | toString (const QDateTime & dateTime , QLocale::FormatType format , QCalendar cal ) const |
| QString | toString (const QDateTime & dateTime , QStringView format , QCalendar cal ) const |
| QString | toString (int i ) const |
| QString | toString (long i ) const |
| QString | toString (qulonglong i ) const |
| QString | toString (short i ) const |
| QString | toString (uint i ) const |
| QString | toString (ulong i ) const |
| QString | toString (ushort i ) const |
| QString | toString (QDate date , QLocale::FormatType format = LongFormat) const |
| QString | toString (QDate date , QStringView format ) const |
| QString | toString (const QDateTime & dateTime , QLocale::FormatType format = LongFormat) const |
| QString | toString (const QDateTime & dateTime , QStringView format ) const |
| QString | toString (double f , char format = 'g', int precision = 6) const |
| QString | toString (float f , char format = 'g', int precision = 6) const |
| QString | toString (int number , int fieldWidth , char32_t fillChar ) const |
| QString | toString (long number , int fieldWidth , char32_t fillChar ) const |
| QString | toString (qlonglong number , int fieldWidth , char32_t fillChar ) const |
| QString | toString (qulonglong number , int fieldWidth , char32_t fillChar ) const |
| QString | toString (short number , int fieldWidth , char32_t fillChar ) const |
| QString | toString (uint number , int fieldWidth , char32_t fillChar ) const |
| QString | toString (ulong number , int fieldWidth , char32_t fillChar ) const |
| QString | toString (ushort number , int fieldWidth , char32_t fillChar ) const |
| QTime | toTime (const QString & string , QLocale::FormatType format = LongFormat) const |
| QTime | toTime (const QString & string , const QString & format ) const |
| uint | toUInt (QStringView s , bool * ok = nullptr) const |
| uint | toUInt (const QString & s , bool * ok = nullptr) const |
| ulong | toULong (QStringView s , bool * ok = nullptr) const |
| ulong | toULong (const QString & s , bool * ok = nullptr) const |
| qulonglong | toULongLong (QStringView s , bool * ok = nullptr) const |
| qulonglong | toULongLong (const QString & s , bool * ok = nullptr) const |
| ushort | toUShort (QStringView s , bool * ok = nullptr) const |
| ushort | toUShort (const QString & s , bool * ok = nullptr) const |
| QString | toUpper (const QString & str ) const |
| QStringList | uiLanguages (QLocale::TagSeparator separator = TagSeparator::Dash) const |
| QList<Qt::DayOfWeek> | weekdays () const |
| QString | zeroDigit () const |
| QLocale & | operator= (const QLocale & other ) |
(從 6.7 起)
const int
|
DefaultTwoDigitBaseYear |
| QLocale | c () |
(從 6.3 起)
QLocale::Language
|
codeToLanguage (QStringView languageCode , QLocale::LanguageCodeTypes codeTypes = AnyLanguageCode) |
(從 6.1 起)
QLocale::Script
|
codeToScript (QStringView scriptCode ) |
(從 6.2 起)
QLocale::Territory
|
codeToTerritory (QStringView territoryCode ) |
(從 6.3 起)
QString
|
languageToCode (QLocale::Language 語言 , QLocale::LanguageCodeTypes codeTypes = AnyLanguageCode) |
| QString | languageToString (QLocale::Language 語言 ) |
| QList<QLocale> | matchingLocales (QLocale::Language 語言 , QLocale::Script script , QLocale::Territory territory ) |
(從 6.1 起)
QString
|
scriptToCode (QLocale::Script script ) |
| QString | scriptToString (QLocale::Script script ) |
| void | setDefault (const QLocale & locale ) |
| QLocale | system () |
(從 6.2 起)
QString
|
territoryToCode (QLocale::Territory territory ) |
(從 6.2 起)
QString
|
territoryToString (QLocale::Territory territory ) |
| size_t | qHash (const QLocale & key , size_t seed = 0) |
| bool | operator!= (const QLocale & lhs , const QLocale & rhs ) |
| bool | operator== (const QLocale & lhs , const QLocale & rhs ) |
QLocale 是為指定語言、可選腳本和地區構造的。它提供將數據格式化成文本、適當本地化及從本地化文本讀取數據的各種設施。
範例:
QLocale egyptian(QLocale::Arabic, QLocale::Egypt); QString s1 = egyptian.toString(1.571429E+07, 'e'); QString s2 = egyptian.toString(10); double d = egyptian.toDouble(s1); int i = egyptian.toInt(s2);
QLocale 支持默認區域設置概念,在應用程序啓動時由係統區域設置確定。可以改變默認區域設置通過調用靜態成員 setDefault ()。設置默認區域設置有下列影響:
以下範例闡明如何直接使用 QLocale:
bool ok; double d; QLocale::setDefault(QLocale::C); // uses '.' as a decimal point QLocale cLocale; // default-constructed C locale d = cLocale.toDouble("1234,56", &ok); // ok == false, d == 0 d = cLocale.toDouble("1234.56", &ok); // ok == true, d == 1234.56 QLocale::setDefault(QLocale::German); // uses ',' as a decimal point QLocale german; // default-constructed German locale d = german.toDouble("1234,56", &ok); // ok == true, d == 1234.56 d = german.toDouble("1234.56", &ok); // ok == false, d == 0 QLocale::setDefault(QLocale::English); // Default locale now uses ',' as a group separator. QString str = QString("%1 %L2 %L3").arg(12345).arg(12345).arg(12345, 0, 16); // str == "12345 12,345 3039"
構造 QLocale 對象的替代方法是通過指定區域設置名稱。
QLocale korean("ko"); QLocale swiss("de_CH");
此構造函數從給定名稱讀取語言、腳本和/或地區,接受下劃綫或破摺號作為分隔符(並忽略任何結尾
.codeset
or
@variant
後綴)。
注意: 對於當前鍵盤輸入區域設置,請查看 QInputMethod::locale ().
QLocale's data is based on Common Locale Data Repository v47.
This data is published by The Unicode Consortium, who aim to follow customary, common use by writers of each language, in each script, in each territory for which data is given. This may in some cases differ from what is recognized as official, depending on how widely that official standard is followed in practice.
For example, although the relevant international standard (from the BIPM) mandates a thin non-breaking space as the separator between groups of digits in numbers, when they are split up to aid readability, and many jurisdictions have adopted this as their official standard for the formatting of numbers, many locales in fact have a traditional way of formatting numbers with punctuators separating groups of digits. CLDR, and thus QLocale, follows this common usage rather than the official standard.
QLocale 針對語言、腳本和地區的很多組閤 (但不是全部) 擁有派生自 CLDR (公共區域設置數據存儲庫) 的數據。若它是采用所有這些的 3 指定鍵值構造的 (視
AnyLanguage
,
AnyScript
or
AnyTerritory
為未指定) 且 QLocale 擁有針對給定組閤的數據,則使用該數據。否則,QLocale 會盡力找齣語言、腳本和地區的閤理組閤,為擁有如這些指定的匹配數據。
CLDR 提供可能的組閤錶,用於填充一個或多個任何未指定鍵;若 QLocale 擁有針對這種可能組閤的數據結果,將使用它。若語言未指定,且無法從腳本和地區確定,或者若 QLocale 不擁有語言數據,則使用 C (當從字符串讀取鍵時) 或默認區域設置 (否則)。
當 QLocale 不擁有如指定鍵的數據,在未指定的地方以可能的鍵填充,但擁有如結果語言的數據,則基於地區、腳本或兩者 (按此次序) 的忽略尋址迴退。這會導緻 QLocale 可能不匹配要求,但將為指定鍵提供可用準許數據的閤適本地化。
使用 language (), script () 和 territory () 以確定實際使用鍵。
另請參閱 QString::arg () 和 QInputMethod::locale ().
此枚舉類型用於標識地區。
單獨地區可能是一個國傢的省,國傢 (目前為止的最常見情況) 或更大地理實體,其中某些本地化細節是特定的。
| 常量 | 值 | 描述 |
|---|---|---|
QLocale::AnyCountry
|
AnyTerritory
|
過時彆名對於
AnyTerritory
|
QLocale::AnyTerritory (since Qt 6.2)
|
0
|
|
QLocale::Afghanistan
|
1
|
|
QLocale::AlandIslands
|
2
|
|
QLocale::Albania
|
3
|
|
QLocale::Algeria
|
4
|
|
QLocale::AmericanSamoa
|
5
|
|
QLocale::Andorra
|
6
|
|
QLocale::Angola
|
7
|
|
QLocale::Anguilla
|
8
|
|
QLocale::Antarctica
|
9
|
|
QLocale::AntiguaAndBarbuda
|
10
|
|
QLocale::Argentina
|
11
|
|
QLocale::Armenia
|
12
|
|
QLocale::Aruba
|
13
|
|
QLocale::AscensionIsland
|
14
|
|
QLocale::Australia
|
15
|
|
QLocale::Austria
|
16
|
|
QLocale::Azerbaijan
|
17
|
|
QLocale::Bahamas
|
18
|
|
QLocale::Bahrain
|
19
|
|
QLocale::Bangladesh
|
20
|
|
QLocale::Barbados
|
21
|
|
QLocale::Belarus
|
22
|
|
QLocale::Belgium
|
23
|
|
QLocale::Belize
|
24
|
|
QLocale::Benin
|
25
|
|
QLocale::Bermuda
|
26
|
|
QLocale::Bhutan
|
27
|
|
QLocale::Bolivia
|
28
|
|
QLocale::Bonaire
|
CaribbeanNetherlands
|
|
QLocale::BosniaAndHerzegowina
|
BosniaAndHerzegovina
|
過時,使用
BosniaAndHerzegovina
代替
|
QLocale::BosniaAndHerzegovina (since Qt 6.0)
|
29
|
|
QLocale::Botswana
|
30
|
|
QLocale::BouvetIsland
|
31
|
|
QLocale::Brazil
|
32
|
|
QLocale::BritishIndianOceanTerritory
|
33
|
|
QLocale::BritishVirginIslands
|
34
|
|
QLocale::Brunei
|
35
|
|
QLocale::Bulgaria
|
36
|
|
QLocale::BurkinaFaso
|
37
|
|
QLocale::Burundi
|
38
|
|
QLocale::Cambodia
|
39
|
|
QLocale::Cameroon
|
40
|
|
QLocale::Canada
|
41
|
|
QLocale::CanaryIslands
|
42
|
|
QLocale::CaribbeanNetherlands
|
44
|
|
QLocale::CapeVerde
|
43
|
|
QLocale::CaymanIslands
|
45
|
|
QLocale::CentralAfricanRepublic
|
46
|
|
QLocale::CeutaAndMelilla
|
47
|
|
QLocale::Chad
|
48
|
|
QLocale::Chile
|
49
|
|
QLocale::China
|
50
|
|
QLocale::ChristmasIsland
|
51
|
|
QLocale::ClippertonIsland
|
52
|
|
QLocale::CocosIslands
|
53
|
|
QLocale::Colombia
|
54
|
|
QLocale::Comoros
|
55
|
|
QLocale::CongoBrazzaville
|
56
|
|
QLocale::CongoKinshasa
|
57
|
|
QLocale::CookIslands
|
58
|
|
QLocale::CostaRica
|
59
|
|
QLocale::Croatia
|
60
|
|
QLocale::Cuba
|
61
|
|
QLocale::Curacao (since Qt 6.0)
|
62
|
|
QLocale::CuraSao
|
Curacao
|
過時,使用
Curacao
代替
|
QLocale::Cyprus
|
63
|
|
QLocale::Czechia (since Qt 6.0)
|
64
|
|
QLocale::CzechRepublic
|
Czechia
|
過時,使用
Czechia
代替
|
QLocale::DemocraticRepublicOfCongo
|
CongoKinshasa
|
過時,使用
CongoKinshasa
代替
|
QLocale::DemocraticRepublicOfKorea
|
NorthKorea
|
過時,使用
NorthKorea
代替
|
QLocale::Denmark
|
65
|
|
QLocale::DiegoGarcia
|
66
|
|
QLocale::Djibouti
|
67
|
|
QLocale::Dominica
|
68
|
|
QLocale::DominicanRepublic
|
69
|
|
QLocale::EastTimor
|
TimorLeste
|
|
QLocale::Ecuador
|
70
|
|
QLocale::Egypt
|
71
|
|
QLocale::ElSalvador
|
72
|
|
QLocale::EquatorialGuinea
|
73
|
|
QLocale::Eritrea
|
74
|
|
QLocale::Estonia
|
75
|
|
QLocale::Eswatini
|
76
|
|
QLocale::Ethiopia
|
77
|
|
QLocale::EuropeanUnion (since Qt 5.7)
|
79
|
|
QLocale::Europe (since Qt 5.12)
|
78
|
|
QLocale::FalklandIslands
|
80
|
|
QLocale::FaroeIslands
|
81
|
|
QLocale::Fiji
|
82
|
|
QLocale::Finland
|
83
|
|
QLocale::France
|
84
|
|
QLocale::FrenchGuiana
|
85
|
|
QLocale::FrenchPolynesia
|
86
|
|
QLocale::FrenchSouthernTerritories
|
87
|
|
QLocale::Gabon
|
88
|
|
QLocale::Gambia
|
89
|
|
QLocale::Georgia
|
90
|
|
QLocale::Germany
|
91
|
|
QLocale::Ghana
|
92
|
|
QLocale::Gibraltar
|
93
|
|
QLocale::Greece
|
94
|
|
QLocale::Greenland
|
95
|
|
QLocale::Grenada
|
96
|
|
QLocale::Guadeloupe
|
97
|
|
QLocale::Guam
|
98
|
|
QLocale::Guatemala
|
99
|
|
QLocale::Guernsey
|
100
|
|
QLocale::Guinea
|
102
|
|
QLocale::GuineaBissau
|
101
|
|
QLocale::Guyana
|
103
|
|
QLocale::Haiti
|
104
|
|
QLocale::HeardAndMcDonaldIslands
|
105
|
|
QLocale::Honduras
|
106
|
|
QLocale::HongKong
|
107
|
|
QLocale::Hungary
|
108
|
|
QLocale::Iceland
|
109
|
|
QLocale::India
|
110
|
|
QLocale::Indonesia
|
111
|
|
QLocale::Iran
|
112
|
|
QLocale::Iraq
|
113
|
|
QLocale::Ireland
|
114
|
|
QLocale::IsleOfMan
|
115
|
|
QLocale::Israel
|
116
|
|
QLocale::Italy
|
117
|
|
QLocale::IvoryCoast
|
118
|
|
QLocale::Jamaica
|
119
|
|
QLocale::Japan
|
120
|
|
QLocale::Jersey
|
121
|
|
QLocale::Jordan
|
122
|
|
QLocale::Kazakhstan
|
123
|
|
QLocale::Kenya
|
124
|
|
QLocale::Kiribati
|
125
|
|
QLocale::Kosovo (since Qt 5.2)
|
126
|
|
QLocale::Kuwait
|
127
|
|
QLocale::Kyrgyzstan
|
128
|
|
QLocale::Laos
|
129
|
|
QLocale::LatinAmerica
|
130
|
|
QLocale::LatinAmericaAndTheCaribbean
|
LatinAmerica
|
過時,使用
LatinAmerica
代替
|
QLocale::Latvia
|
131
|
|
QLocale::Lebanon
|
132
|
|
QLocale::Lesotho
|
133
|
|
QLocale::Liberia
|
134
|
|
QLocale::Libya
|
135
|
|
QLocale::Liechtenstein
|
136
|
|
QLocale::Lithuania
|
137
|
|
QLocale::Luxembourg
|
138
|
|
QLocale::Macao
|
139
|
|
QLocale::Macau
|
Macao
|
|
QLocale::Macedonia
|
140
|
|
QLocale::Madagascar
|
141
|
|
QLocale::Malawi
|
142
|
|
QLocale::Malaysia
|
143
|
|
QLocale::Maldives
|
144
|
|
QLocale::Mali
|
145
|
|
QLocale::Malta
|
146
|
|
QLocale::MarshallIslands
|
147
|
|
QLocale::Martinique
|
148
|
|
QLocale::Mauritania
|
149
|
|
QLocale::Mauritius
|
150
|
|
QLocale::Mayotte
|
151
|
|
QLocale::Mexico
|
152
|
|
QLocale::Micronesia
|
153
|
|
QLocale::Moldova
|
154
|
|
QLocale::Monaco
|
155
|
|
QLocale::Mongolia
|
156
|
|
QLocale::Montenegro
|
157
|
|
QLocale::Montserrat
|
158
|
|
QLocale::Morocco
|
159
|
|
QLocale::Mozambique
|
160
|
|
QLocale::Myanmar
|
161
|
|
QLocale::Namibia
|
162
|
|
QLocale::NauruCountry
|
NauruTerritory
|
過時彆名對於
NauruTerritory
|
QLocale::NauruTerritory (since Qt 6.2)
|
163
|
|
QLocale::Nepal
|
164
|
|
QLocale::Netherlands
|
165
|
|
QLocale::NewCaledonia
|
166
|
|
QLocale::NewZealand
|
167
|
|
QLocale::Nicaragua
|
168
|
|
QLocale::Niger
|
170
|
|
QLocale::Nigeria
|
169
|
|
QLocale::Niue
|
171
|
|
QLocale::NorfolkIsland
|
172
|
|
QLocale::NorthernMarianaIslands
|
173
|
|
QLocale::NorthKorea
|
174
|
|
QLocale::Norway
|
175
|
|
QLocale::Oman
|
176
|
|
QLocale::OutlyingOceania (since Qt 5.7)
|
177
|
|
QLocale::Pakistan
|
178
|
|
QLocale::Palau
|
179
|
|
QLocale::PalestinianTerritories
|
180
|
|
QLocale::Panama
|
181
|
|
QLocale::PapuaNewGuinea
|
182
|
|
QLocale::Paraguay
|
183
|
|
QLocale::PeoplesRepublicOfCongo
|
CongoBrazzaville
|
過時,使用
CongoBrazzaville
代替
|
QLocale::Peru
|
184
|
|
QLocale::Philippines
|
185
|
|
QLocale::Pitcairn
|
186
|
|
QLocale::Poland
|
187
|
|
QLocale::Portugal
|
188
|
|
QLocale::PuertoRico
|
189
|
|
QLocale::Qatar
|
190
|
|
QLocale::RepublicOfKorea
|
SouthKorea
|
過時,使用
SouthKorea
代替
|
QLocale::Reunion
|
191
|
|
QLocale::Romania
|
192
|
|
QLocale::RussianFederation
|
Russia
|
|
QLocale::Russia
|
193
|
|
QLocale::Rwanda
|
194
|
|
QLocale::SaintBarthelemy
|
195
|
|
QLocale::SaintHelena
|
196
|
|
QLocale::SaintKittsAndNevis
|
197
|
|
QLocale::SaintLucia
|
198
|
|
QLocale::SaintMartin
|
199
|
|
QLocale::SaintPierreAndMiquelon
|
200
|
|
QLocale::SaintVincentAndGrenadines
|
201
|
|
QLocale::SaintVincentAndTheGrenadines
|
SaintVincentAndGrenadines
|
|
QLocale::Samoa
|
202
|
|
QLocale::SanMarino
|
203
|
|
QLocale::SaoTomeAndPrincipe
|
204
|
|
QLocale::SaudiArabia
|
205
|
|
QLocale::Senegal
|
206
|
|
QLocale::Serbia
|
207
|
|
QLocale::Seychelles
|
208
|
|
QLocale::SierraLeone
|
209
|
|
QLocale::Singapore
|
210
|
|
QLocale::SintMaarten
|
211
|
|
QLocale::Slovakia
|
212
|
|
QLocale::Slovenia
|
213
|
|
QLocale::SolomonIslands
|
214
|
|
QLocale::Somalia
|
215
|
|
QLocale::SouthAfrica
|
216
|
|
QLocale::SouthGeorgiaAndSouthSandwichIslands
|
217
|
|
QLocale::SouthGeorgiaAndTheSouthSandwichIslands
|
SouthGeorgiaAndSouthSandwichIslands
|
|
QLocale::SouthKorea
|
218
|
|
QLocale::SouthSudan
|
219
|
|
QLocale::Spain
|
220
|
|
QLocale::SriLanka
|
221
|
|
QLocale::Sudan
|
222
|
|
QLocale::Suriname
|
223
|
|
QLocale::SvalbardAndJanMayen
|
224
|
|
QLocale::SvalbardAndJanMayenIslands
|
SvalbardAndJanMayen
|
|
QLocale::Swaziland
|
Eswatini
|
|
QLocale::Sweden
|
225
|
|
QLocale::Switzerland
|
226
|
|
QLocale::Syria
|
227
|
|
QLocale::SyrianArabRepublic
|
Syria
|
過時,使用
Syria
代替
|
QLocale::Taiwan
|
228
|
|
QLocale::Tajikistan
|
229
|
|
QLocale::Tanzania
|
230
|
|
QLocale::Thailand
|
231
|
|
QLocale::TimorLeste
|
232
|
|
QLocale::Togo
|
233
|
|
QLocale::TokelauCountry
|
TokelauTerritory
|
過時彆名對於
TokelauTerritory
|
QLocale::TokelauTerritory (since Qt 6.2)
|
234
|
|
QLocale::Tonga
|
235
|
|
QLocale::TrinidadAndTobago
|
236
|
|
QLocale::TristanDaCunha
|
237
|
|
QLocale::Tunisia
|
238
|
|
QLocale::Turkey
|
239
|
|
QLocale::Turkmenistan
|
240
|
|
QLocale::TurksAndCaicosIslands
|
241
|
|
QLocale::TuvaluCountry
|
TuvaluTerritory
|
過時彆名對於
TuvaluTerritory
|
QLocale::TuvaluTerritory (since Qt 6.2)
|
242
|
|
QLocale::Uganda
|
243
|
|
QLocale::Ukraine
|
244
|
|
QLocale::UnitedArabEmirates
|
245
|
|
QLocale::UnitedKingdom
|
246
|
|
QLocale::UnitedStates
|
248
|
|
QLocale::UnitedStatesOutlyingIslands
|
247
|
|
QLocale::UnitedStatesMinorOutlyingIslands
|
UnitedStatesOutlyingIslands
|
|
QLocale::UnitedStatesVirginIslands
|
249
|
|
QLocale::Uruguay
|
250
|
|
QLocale::Uzbekistan
|
251
|
|
QLocale::Vanuatu
|
252
|
|
QLocale::VaticanCity
|
253
|
|
QLocale::VaticanCityState
|
VaticanCity
|
|
QLocale::Venezuela
|
254
|
|
QLocale::Vietnam
|
255
|
|
QLocale::WallisAndFutuna
|
256
|
|
QLocale::WallisAndFutunaIslands
|
WallisAndFutuna
|
|
QLocale::WesternSahara
|
257
|
|
QLocale::World (since Qt 5.12)
|
258
|
|
QLocale::Yemen
|
259
|
|
QLocale::Zambia
|
260
|
|
QLocale::Zimbabwe
|
261
|
注意: 使用針對此枚舉的 Territory 彆名,若可能。Country 枚舉在以後的發行中應該被重命名成 Territory。
另請參閱 territory (), territoryToString (), codeToTerritory (),和 territoryToCode ().
指定貨幣符號的格式。
| 常量 | 值 | 描述 |
|---|---|---|
QLocale::CurrencyIsoCode
|
0
|
a ISO-4217 code of the currency. |
QLocale::CurrencySymbol
|
1
|
a currency symbol. |
QLocale::CurrencyDisplayName
|
2
|
a user readable name of the currency. |
Specifies the format for representation of data quantities.
| 常量 | 值 | 描述 |
|---|---|---|
QLocale::DataSizeIecFormat
|
0
|
format using base 1024 and IEC prefixes: KiB, MiB, GiB, ... |
QLocale::DataSizeTraditionalFormat
|
DataSizeSIQuantifiers
|
format using base 1024 and SI prefixes: kB, MB, GB, ... |
QLocale::DataSizeSIFormat
|
DataSizeBase1000 | DataSizeSIQuantifiers
|
format using base 1000 and SI prefixes: kB, MB, GB, ... |
The DataSizeFormats type is a typedef for QFlags <DataSizeFormat>. It stores an OR combination of DataSizeFormat values.
另請參閱 formattedDataSize ().
This enum defines a constant that can be given as precision to QString::number (), QByteArray::number (),和 QLocale::toString () when converting floats or doubles, in order to express a variable number of digits as precision.
| 常量 | 值 | 描述 |
|---|---|---|
QLocale::FloatingPointShortest
|
-128
|
The conversion algorithm will try to find the shortest accurate representation for the given number. "Accurate" means that you get the exact same number back from an inverse conversion on the generated string representation. In particular, trailing zeros are omitted (from the mantissa, in exponent formats). |
另請參閱 toString (), QString::number (),和 QByteArray::number ().
此枚舉描述可以使用的不同格式,當轉換 QDate , QTime ,和 QDateTime objects, as well as months and days, to strings specific to the locale.
| 常量 | 值 | 描述 |
|---|---|---|
QLocale::LongFormat
|
0
|
Longer format. |
QLocale::ShortFormat
|
1
|
Shorter format. |
QLocale::NarrowFormat
|
2
|
A special version for use when space is very limited. |
注意:
NarrowFormat
might contain the same text for different months and days. It can even be an empty string if the locale doesn't support narrow names, so you should avoid using it for date formatting. Also, for the system locale this format is the same as
ShortFormat
.
另請參閱 dateFormat (), timeFormat (), dateTimeFormat (), monthName (), standaloneMonthName (), dayName (), standaloneDayName (), toDate (), toTime (),和 toDateTime ().
此枚舉類型用於指定語言。
| 常量 | 值 | 描述 |
|---|---|---|
QLocale::AnyLanguage
|
0
|
|
QLocale::C
|
1
|
簡化的 English 區域設置;見 QLocale::c () |
QLocale::Abkhazian
|
2
|
|
QLocale::Afan
|
Oromo
|
過時,請使用 Oromo |
QLocale::Afar
|
3
|
|
QLocale::Afrikaans
|
4
|
|
QLocale::Aghem
|
5
|
|
QLocale::Akan
|
6
|
|
QLocale::Akkadian (since Qt 5.1)
|
7
|
|
QLocale::Akoose (since Qt 5.3)
|
8
|
|
QLocale::Albanian
|
9
|
|
QLocale::AmericanSignLanguage (since Qt 5.7)
|
10
|
|
QLocale::Amharic
|
11
|
|
QLocale::AncientEgyptian (since Qt 5.1)
|
12
|
|
QLocale::AncientGreek (since Qt 5.1)
|
13
|
|
QLocale::Anii (since Qt 6.7)
|
341
|
|
QLocale::Arabic
|
14
|
|
QLocale::Aragonese (since Qt 5.1)
|
15
|
|
QLocale::Aramaic (since Qt 5.1)
|
16
|
|
QLocale::Armenian
|
17
|
|
QLocale::Assamese
|
18
|
|
QLocale::Asturian
|
19
|
|
QLocale::Asu
|
20
|
|
QLocale::Atsam
|
21
|
|
QLocale::Avaric
|
22
|
|
QLocale::Avestan
|
23
|
|
QLocale::Aymara
|
24
|
|
QLocale::Azerbaijani
|
25
|
|
QLocale::Bafia
|
26
|
|
QLocale::Balinese (since Qt 5.1)
|
27
|
|
QLocale::Baluchi (since Qt 6.6)
|
337
|
|
QLocale::Bambara
|
28
|
|
QLocale::Bamun (since Qt 5.1)
|
29
|
|
QLocale::Bangla (since Qt 6.0)
|
30
|
|
QLocale::Basaa
|
31
|
|
QLocale::Bashkir
|
32
|
|
QLocale::Basque
|
33
|
|
QLocale::BatakToba (since Qt 5.1)
|
34
|
|
QLocale::Belarusian
|
35
|
|
QLocale::Bemba
|
36
|
|
QLocale::Bena
|
37
|
|
QLocale::Bengali
|
Bangla
|
過時,請使用 Bangla |
QLocale::Bhojpuri (since Qt 5.7)
|
38
|
|
QLocale::Bhutani
|
Dzongkha
|
過時,請使用 Dzongkha |
QLocale::Bislama
|
39
|
|
QLocale::Blin
|
40
|
|
QLocale::Bodo
|
41
|
|
QLocale::Bosnian
|
42
|
|
QLocale::Breton
|
43
|
|
QLocale::Buginese (since Qt 5.1)
|
44
|
|
QLocale::Bulgarian
|
45
|
|
QLocale::Burmese
|
46
|
|
QLocale::Byelorussian
|
Belarusian
|
過時,請使用 Belarusian |
QLocale::Cambodian
|
Khmer
|
過時,請使用 Khmer |
QLocale::Cantonese (since Qt 5.7)
|
47
|
|
QLocale::Catalan
|
48
|
|
QLocale::Cebuano (since Qt 5.14)
|
49
|
|
QLocale::CentralAtlasTamazight (since Qt 6.0)
|
50
|
|
QLocale::CentralKurdish (since Qt 5.5)
|
51
|
|
QLocale::CentralMoroccoTamazight
|
CentralAtlasTamazight
|
過時,請使用 CentralAtlasTamazight |
QLocale::Chakma (since Qt 5.1)
|
52
|
|
QLocale::Chamorro
|
53
|
|
QLocale::Chechen
|
54
|
|
QLocale::Cherokee
|
55
|
|
QLocale::Chewa
|
Nyanja
|
過時,請使用 Nyanja |
QLocale::Chickasaw (since Qt 5.14)
|
56
|
|
QLocale::Chiga
|
57
|
|
QLocale::Chinese
|
58
|
(普通話) |
QLocale::Church
|
59
|
|
QLocale::Chuvash
|
60
|
|
QLocale::Colognian
|
61
|
|
QLocale::Coptic (since Qt 5.1)
|
62
|
|
QLocale::Cornish
|
63
|
|
QLocale::Corsican
|
64
|
|
QLocale::Cree
|
65
|
|
QLocale::Croatian
|
66
|
|
QLocale::Czech
|
67
|
|
QLocale::Danish
|
68
|
|
QLocale::Divehi
|
69
|
|
QLocale::Dogri (since Qt 5.1)
|
70
|
|
QLocale::Duala
|
71
|
|
QLocale::Dutch
|
72
|
|
QLocale::Dzongkha
|
73
|
|
QLocale::Embu
|
74
|
|
QLocale::English
|
75
|
|
QLocale::Erzya (since Qt 5.14)
|
76
|
|
QLocale::Esperanto
|
77
|
|
QLocale::Estonian
|
78
|
|
QLocale::Ewe
|
79
|
|
QLocale::Ewondo
|
80
|
|
QLocale::Faroese
|
81
|
|
QLocale::Fijian
|
82
|
|
QLocale::Filipino
|
83
|
|
QLocale::Finnish
|
84
|
|
QLocale::French
|
85
|
|
QLocale::Frisian
|
WesternFrisian
|
如同 WesternFrisian |
QLocale::Friulian
|
86
|
|
QLocale::Fulah
|
87
|
|
QLocale::Ga
|
89
|
|
QLocale::Gaelic
|
88
|
|
QLocale::Galician
|
90
|
|
QLocale::Ganda
|
91
|
|
QLocale::Geez
|
92
|
|
QLocale::Georgian
|
93
|
|
QLocale::German
|
94
|
|
QLocale::Gothic (since Qt 5.1)
|
95
|
|
QLocale::Greek
|
96
|
|
QLocale::Greenlandic
|
Kalaallisut
|
過時,請使用 Kalaallisut |
QLocale::Guarani
|
97
|
|
QLocale::Gujarati
|
98
|
|
QLocale::Gusii
|
99
|
|
QLocale::Haitian
|
100
|
|
QLocale::Haryanvi (since Qt 6.5)
|
330
|
|
QLocale::Hausa
|
101
|
|
QLocale::Hawaiian
|
102
|
|
QLocale::Hebrew
|
103
|
|
QLocale::Herero
|
104
|
|
QLocale::Hindi
|
105
|
|
QLocale::HiriMotu
|
106
|
|
QLocale::Hungarian
|
107
|
|
QLocale::Icelandic
|
108
|
|
QLocale::Ido (since Qt 5.12)
|
109
|
|
QLocale::Igbo
|
110
|
|
QLocale::InariSami (since Qt 5.5)
|
111
|
|
QLocale::Indonesian
|
112
|
|
QLocale::Ingush (since Qt 5.1)
|
113
|
|
QLocale::Interlingua
|
114
|
|
QLocale::Interlingue
|
115
|
|
QLocale::Inuktitut
|
116
|
|
QLocale::Inupiak
|
Inupiaq
|
過時,請使用 Inupiaq |
QLocale::Inupiaq (since Qt 6.0)
|
117
|
|
QLocale::Irish
|
118
|
|
QLocale::Italian
|
119
|
|
QLocale::Japanese
|
120
|
|
QLocale::Javanese
|
121
|
|
QLocale::Jju
|
122
|
|
QLocale::JolaFonyi
|
123
|
|
QLocale::Kabuverdianu
|
124
|
|
QLocale::Kabyle
|
125
|
|
QLocale::Kaingang (since Qt 6.3)
|
328
|
|
QLocale::Kako
|
126
|
|
QLocale::Kalaallisut (since Qt 6.0)
|
127
|
|
QLocale::Kalenjin
|
128
|
|
QLocale::Kamba
|
129
|
|
QLocale::Kangri (since Qt 6.7)
|
342
|
|
QLocale::Kannada
|
130
|
|
QLocale::Kanuri
|
131
|
|
QLocale::KaraKalpak (since Qt 6.9)
|
345
|
|
QLocale::Kashmiri
|
132
|
|
QLocale::Kazakh
|
133
|
|
QLocale::Kenyang (since Qt 5.5)
|
134
|
|
QLocale::Khmer
|
135
|
|
QLocale::Kiche (since Qt 5.5)
|
136
|
|
QLocale::Kikuyu
|
137
|
|
QLocale::Kinyarwanda
|
138
|
|
QLocale::Kirghiz
|
Kyrgyz
|
過時,請使用 Kyrgyz |
QLocale::Komi
|
139
|
|
QLocale::Kongo
|
140
|
|
QLocale::Konkani
|
141
|
|
QLocale::Korean
|
142
|
|
QLocale::Koro
|
143
|
|
QLocale::KoyraboroSenni
|
144
|
|
QLocale::KoyraChiini
|
145
|
|
QLocale::Kpelle
|
146
|
|
QLocale::Kuanyama (since Qt 6.0)
|
147
|
|
QLocale::Kurdish
|
148
|
|
QLocale::Kurundi
|
Rundi
|
過時,請使用 Rundi |
QLocale::Kuvi (since Qt 6.8)
|
344
|
|
QLocale::Kwanyama
|
Kuanyama
|
過時,請使用 Kuanyama |
QLocale::Kwasio
|
149
|
|
QLocale::Kyrgyz (since Qt 6.0)
|
150
|
|
QLocale::Lakota (since Qt 5.3)
|
151
|
|
QLocale::Langi
|
152
|
|
QLocale::Lao
|
153
|
|
QLocale::Latin
|
154
|
|
QLocale::Latvian
|
155
|
|
QLocale::Lezghian (since Qt 5.5)
|
156
|
|
QLocale::Limburgish
|
157
|
|
QLocale::Lingala
|
158
|
|
QLocale::Ligurian (since Qt 6.6)
|
338
|
|
QLocale::LiteraryChinese (since Qt 5.7)
|
159
|
|
QLocale::Lithuanian
|
160
|
|
QLocale::Lojban (since Qt 5.12)
|
161
|
|
QLocale::LowerSorbian (since Qt 5.5)
|
162
|
|
QLocale::LowGerman
|
163
|
|
QLocale::LubaKatanga
|
164
|
|
QLocale::LuleSami (since Qt 5.5)
|
165
|
|
QLocale::Luo
|
166
|
|
QLocale::Luxembourgish
|
167
|
|
QLocale::Luyia
|
168
|
|
QLocale::Macedonian
|
169
|
|
QLocale::Machame
|
170
|
|
QLocale::Maithili (since Qt 5.5)
|
171
|
|
QLocale::MakhuwaMeetto
|
172
|
|
QLocale::Makonde
|
173
|
|
QLocale::Malagasy
|
174
|
|
QLocale::Malay
|
176
|
|
QLocale::Malayalam
|
175
|
|
QLocale::Maltese
|
177
|
|
QLocale::Mandingo (since Qt 5.1)
|
178
|
|
QLocale::Manipuri (since Qt 5.1)
|
179
|
|
QLocale::Manx
|
180
|
|
QLocale::Maori
|
181
|
|
QLocale::Mapuche (since Qt 5.5)
|
182
|
|
QLocale::Marathi
|
183
|
|
QLocale::Marshallese
|
184
|
|
QLocale::Masai
|
185
|
|
QLocale::Mazanderani (since Qt 5.7)
|
186
|
|
QLocale::Mende (since Qt 5.5)
|
187
|
|
QLocale::Meru
|
188
|
|
QLocale::Meta
|
189
|
|
QLocale::Mohawk (since Qt 5.5)
|
190
|
|
QLocale::Moksha (since Qt 6.5)
|
333
|
|
QLocale::Mongolian
|
191
|
|
QLocale::Morisyen
|
192
|
|
QLocale::Mundang
|
193
|
|
QLocale::Muscogee (since Qt 5.14)
|
194
|
|
QLocale::Nama
|
195
|
|
QLocale::NauruLanguage
|
196
|
|
QLocale::Navaho
|
Navajo
|
過時,請使用 Navajo |
QLocale::Navajo (since Qt 6.0)
|
197
|
|
QLocale::Ndonga
|
198
|
|
QLocale::Nepali
|
199
|
|
QLocale::Newari (since Qt 5.7)
|
200
|
|
QLocale::Ngiemboon
|
201
|
|
QLocale::Nheengatu (since Qt 6.3)
|
329
|
|
QLocale::NigerianPidgin (since Qt 6.0)
|
203
|
|
QLocale::Ngomba
|
202
|
|
QLocale::Nko (since Qt 5.5)
|
204
|
|
QLocale::NorthernFrisian (since Qt 6.5)
|
331
|
|
QLocale::NorthernLuri (since Qt 5.7)
|
205
|
|
QLocale::NorthernSami
|
206
|
|
QLocale::NorthernSotho
|
207
|
|
QLocale::NorthNdebele
|
208
|
|
QLocale::NorwegianBokmal
|
209
|
|
QLocale::NorwegianNynorsk
|
210
|
|
QLocale::Nuer
|
211
|
|
QLocale::Nyanja
|
212
|
|
QLocale::Nyankole
|
213
|
|
QLocale::Obolo (since Qt 6.5)
|
336
|
|
QLocale::Occitan
|
214
|
|
QLocale::Odia (since Qt 6.0)
|
215
|
|
QLocale::Ojibwa
|
216
|
|
QLocale::OldIrish (since Qt 5.1)
|
217
|
|
QLocale::OldNorse (since Qt 5.1)
|
218
|
|
QLocale::OldPersian (since Qt 5.1)
|
219
|
|
QLocale::Oriya
|
Odia
|
過時,請使用 Odia |
QLocale::Oromo
|
220
|
|
QLocale::Osage (since Qt 5.7)
|
221
|
|
QLocale::Ossetic
|
222
|
|
QLocale::Pahlavi (since Qt 5.1)
|
223
|
|
QLocale::Palauan (since Qt 5.7)
|
224
|
|
QLocale::Pali
|
225
|
|
QLocale::Papiamento (since Qt 5.7)
|
226
|
|
QLocale::Pashto
|
227
|
|
QLocale::Persian
|
228
|
|
QLocale::Phoenician (since Qt 5.1)
|
229
|
|
QLocale::Pijin (since Qt 6.5)
|
335
|
|
QLocale::Polish
|
230
|
|
QLocale::Portuguese
|
231
|
|
QLocale::Prussian (since Qt 5.5)
|
232
|
|
QLocale::Punjabi
|
233
|
|
QLocale::Quechua
|
234
|
|
QLocale::Rajasthani (since Qt 6.5)
|
332
|
|
QLocale::RhaetoRomance
|
Romansh
|
過時,請使用 Romansh |
QLocale::Rohingya (since Qt 6.6)
|
339
|
|
QLocale::Romanian
|
235
|
|
QLocale::Romansh
|
236
|
|
QLocale::Rombo
|
237
|
|
QLocale::Rundi
|
238
|
|
QLocale::Russian
|
239
|
|
QLocale::Rwa
|
240
|
|
QLocale::Saho
|
241
|
|
QLocale::Sakha
|
242
|
|
QLocale::Samburu
|
243
|
|
QLocale::Samoan
|
244
|
|
QLocale::Sango
|
245
|
|
QLocale::Sangu
|
246
|
|
QLocale::Sanskrit
|
247
|
|
QLocale::Santali (since Qt 5.1)
|
248
|
|
QLocale::Sardinian
|
249
|
|
QLocale::Saurashtra (since Qt 5.1)
|
250
|
|
QLocale::Sena
|
251
|
|
QLocale::Serbian
|
252
|
|
QLocale::Shambala
|
253
|
|
QLocale::Shona
|
254
|
|
QLocale::SichuanYi
|
255
|
|
QLocale::Sicilian (since Qt 5.12)
|
256
|
|
QLocale::Sidamo
|
257
|
|
QLocale::Silesian (since Qt 5.14)
|
258
|
|
QLocale::Sindhi
|
259
|
|
QLocale::Sinhala
|
260
|
|
QLocale::SkoltSami (since Qt 5.5)
|
261
|
|
QLocale::Slovak
|
262
|
|
QLocale::Slovenian
|
263
|
|
QLocale::Soga
|
264
|
|
QLocale::Somali
|
265
|
|
QLocale::SouthernKurdish (since Qt 5.12)
|
266
|
|
QLocale::SouthernSami (since Qt 5.5)
|
267
|
|
QLocale::SouthernSotho
|
268
|
|
QLocale::SouthNdebele
|
269
|
|
QLocale::Spanish
|
270
|
|
QLocale::StandardMoroccanTamazight (since Qt 5.3)
|
271
|
|
QLocale::Sundanese
|
272
|
|
QLocale::Swahili
|
273
|
|
QLocale::SwampyCree (since Qt 6.9)
|
346
|
|
QLocale::Swati
|
274
|
|
QLocale::Swedish
|
275
|
|
QLocale::SwissGerman
|
276
|
|
QLocale::Syriac
|
277
|
|
QLocale::Tachelhit
|
278
|
|
QLocale::Tahitian
|
279
|
|
QLocale::TaiDam (since Qt 5.1)
|
280
|
|
QLocale::Taita
|
281
|
|
QLocale::Tajik
|
282
|
|
QLocale::Tamil
|
283
|
|
QLocale::Taroko
|
284
|
|
QLocale::Tasawaq
|
285
|
|
QLocale::Tatar
|
286
|
|
QLocale::Telugu
|
287
|
|
QLocale::Teso
|
288
|
|
QLocale::Thai
|
289
|
|
QLocale::Tibetan
|
290
|
|
QLocale::Tigre
|
291
|
|
QLocale::Tigrinya
|
292
|
|
QLocale::TokelauLanguage (since Qt 5.7)
|
293
|
|
QLocale::TokiPona (since Qt 6.5)
|
334
|
|
QLocale::TokPisin (since Qt 5.7)
|
294
|
|
QLocale::Tongan
|
295
|
|
QLocale::Torwali (since Qt 6.6)
|
340
|
|
QLocale::Tsonga
|
296
|
|
QLocale::Tswana
|
297
|
|
QLocale::Turkish
|
298
|
|
QLocale::Turkmen
|
299
|
|
QLocale::TuvaluLanguage (since Qt 5.7)
|
300
|
|
QLocale::Tyap
|
301
|
|
QLocale::Ugaritic (since Qt 5.1)
|
302
|
|
QLocale::Uighur
|
Uyghur
|
過時,請使用 Uyghur |
QLocale::Uigur
|
Uyghur
|
過時,請使用 Uyghur |
QLocale::Ukrainian
|
303
|
|
QLocale::UpperSorbian (since Qt 5.5)
|
304
|
|
QLocale::Urdu
|
305
|
|
QLocale::Uyghur (since Qt 6.0)
|
306
|
|
QLocale::Uzbek
|
307
|
|
QLocale::Vai
|
308
|
|
QLocale::Venda
|
309
|
|
QLocale::Venetian (since Qt 6.7)
|
343
|
|
QLocale::Vietnamese
|
310
|
|
QLocale::Volapuk
|
311
|
|
QLocale::Vunjo
|
312
|
|
QLocale::Walamo
|
Wolaytta
|
過時,請使用 Wolaytta |
QLocale::Walloon
|
313
|
|
QLocale::Walser
|
314
|
|
QLocale::Warlpiri (since Qt 5.5)
|
315
|
|
QLocale::Welsh
|
316
|
|
QLocale::WesternBalochi (since Qt 5.12)
|
317
|
|
QLocale::WesternFrisian
|
318
|
如同 Frisian |
QLocale::Wolaytta (since Qt 6.0)
|
319
|
|
QLocale::Wolof
|
320
|
|
QLocale::Xhosa
|
321
|
|
QLocale::Yangben
|
322
|
|
QLocale::Yiddish
|
323
|
|
QLocale::Yoruba
|
324
|
|
QLocale::Zarma
|
325
|
|
QLocale::Zhuang
|
326
|
|
QLocale::Zulu
|
327
|
另請參閱 language () 和 languageToString ().
This enum defines language code types that can be used to restrict set of language codes considered by
codeToLanguage
and
languageToCode
.
| 常量 | 值 | 描述 |
|---|---|---|
QLocale::ISO639Part1
|
1 << 0
|
ISO 639 Part 1 Alpha 2 code. |
QLocale::ISO639Part2B
|
1 << 1
|
ISO 639 Part 2 bibliographic Alpha 3 code. |
QLocale::ISO639Part2T
|
1 << 2
|
ISO 639 Part 2 terminological Alpha 3 code. |
QLocale::ISO639Part3
|
1 << 3
|
ISO 639 Part 3 Alpha 3 code. |
QLocale::LegacyLanguageCode
|
1 << 15
|
Codes that are not part of the above set, but that were supported by Qt in the past. This value can only be used by codeToLanguage (). It is ignored when passed to languageToCode (). |
QLocale::ISO639Part2
|
ISO639Part2B | ISO639Part2T
|
Any ISO 639 Part 2 code. |
QLocale::ISO639Alpha2
|
ISO639Part1
|
Any ISO-639 2-letter code. |
QLocale::ISO639Alpha3
|
ISO639Part2 | ISO639Part3
|
Any ISO-639 3-letter code. |
QLocale::ISO639
|
ISO639Alpha2 | ISO639Alpha3
|
Any ISO 639 code. |
QLocale::AnyLanguageCode
|
-1
|
Specifies that any code can be used. |
LanguageCodeTypes 類型是 typedef 對於 QFlags <LanguageCodeType>. It stores an OR combination of LanguageCodeType values.
此枚舉定義用於度量的單位。
| 常量 | 值 | 描述 |
|---|---|---|
QLocale::MetricSystem
|
0
|
This value indicates metric units, such as meters, centimeters and millimeters, based on SI . |
QLocale::ImperialUSSystem
|
1
|
This value indicates imperial units, such as inches and miles as they are used in the United States. |
QLocale::ImperialUKSystem
|
2
|
This value indicates imperial units, such as inches and miles as they are used in the United Kingdom. |
QLocale::ImperialSystem
|
ImperialUSSystem
|
Provided for compatibility. Same as ImperialUSSystem |
This enum defines a set of options for number-to-string and string-to-number conversions. They can be retrieved with numberOptions () 和設置采用 setNumberOptions ().
| 常量 | 值 | 描述 |
|---|---|---|
QLocale::DefaultNumberOptions
|
0x0
|
This option represents the default behavior for all locales except the C locale, with group separators, with one leading zero in single digit exponents, and without trailing zeroes at the end of the fractional part (when present). |
QLocale::OmitGroupSeparator
|
0x01
|
If this option is set, the number-to-string functions will not break up digits into groups. The C locale sets this option by default. The default for all other locales is to break up digits into groups, in the whole-number part of a number, with group separators. |
QLocale::RejectGroupSeparator
|
0x02
|
If this option is set, the string-to-number functions will fail if they encounter group separators in their input. The default is to accept numbers containing correctly placed group separators. |
QLocale::OmitLeadingZeroInExponent
|
0x04
|
If this option is set, the number-to-string functions will not pad exponents with zeroes when printing floating point numbers in scientific notation. The default is to add one leading zero to single digit exponents. |
QLocale::RejectLeadingZeroInExponent
|
0x08
|
If this option is set, the string-to-number functions will fail if they encounter an exponent padded with zeroes when parsing a floating point number in scientific notation. The default is to accept such padding. |
QLocale::IncludeTrailingZeroesAfterDot
|
0x10
|
If this option is set, the number-to-string functions will pad numbers with zeroes to the requested precision in "g" or "most concise" mode. The default is to omit trailing zeroes, which may leave fewer digits in the fractional part than the precision asked for. |
QLocale::RejectTrailingZeroesAfterDot
|
0x20
|
If this option is set, the string-to-number functions will fail if they encounter trailing zeroes at the end of the fractional part, when parsing a number in scientific or decimal representation. The default is to accept trailing zeroes. |
NumberOptions 類型是 typedef 對於 QFlags <NumberOption>. It stores an OR combination of NumberOption values.
另請參閱 setNumberOptions (), numberOptions (),和 FloatingPointPrecisionOption .
此枚舉為區域設置特定引號,定義一組可能的樣式。
| 常量 | 值 | 描述 |
|---|---|---|
QLocale::StandardQuotation
|
0
|
If this option is set, the standard quotation marks will be used to quote strings. |
QLocale::AlternateQuotation
|
1
|
If this option is set, the alternate quotation marks will be used to quote strings. |
另請參閱 quoteString ().
此枚舉類型用於指定腳本。
| 常量 | 值 | 描述 |
|---|---|---|
QLocale::AnyScript
|
0
|
|
QLocale::AdlamScript (since Qt 5.7)
|
1
|
|
QLocale::AhomScript (since Qt 5.7)
|
2
|
|
QLocale::AnatolianHieroglyphsScript (since Qt 5.7)
|
3
|
|
QLocale::ArabicScript
|
4
|
|
QLocale::ArmenianScript
|
5
|
|
QLocale::AvestanScript (since Qt 5.1)
|
6
|
|
QLocale::BalineseScript (since Qt 5.1)
|
7
|
|
QLocale::BamumScript (since Qt 5.1)
|
8
|
|
QLocale::BanglaScript (since Qt 6.0)
|
9
|
|
QLocale::BassaVahScript (since Qt 5.5)
|
10
|
|
QLocale::BatakScript (since Qt 5.1)
|
11
|
|
QLocale::BengaliScript
|
BanglaScript
|
過時,請使用 BanglaScript |
QLocale::BhaiksukiScript (since Qt 5.7)
|
12
|
|
QLocale::BopomofoScript (since Qt 5.1)
|
13
|
|
QLocale::BrahmiScript (since Qt 5.1)
|
14
|
|
QLocale::BrailleScript (since Qt 5.1)
|
15
|
|
QLocale::BugineseScript (since Qt 5.1)
|
16
|
|
QLocale::BuhidScript (since Qt 5.1)
|
17
|
|
QLocale::CanadianAboriginalScript (since Qt 5.1)
|
18
|
|
QLocale::CarianScript (since Qt 5.1)
|
19
|
|
QLocale::CaucasianAlbanianScript (since Qt 5.5)
|
20
|
|
QLocale::ChakmaScript (since Qt 5.1)
|
21
|
|
QLocale::ChamScript (since Qt 5.1)
|
22
|
|
QLocale::CherokeeScript
|
23
|
|
QLocale::CopticScript (since Qt 5.1)
|
24
|
|
QLocale::CuneiformScript (since Qt 5.1)
|
25
|
|
QLocale::CypriotScript (since Qt 5.1)
|
26
|
|
QLocale::CyrillicScript
|
27
|
|
QLocale::DeseretScript (since Qt 5.1)
|
28
|
|
QLocale::DevanagariScript
|
29
|
|
QLocale::DuployanScript (since Qt 5.5)
|
30
|
|
QLocale::EgyptianHieroglyphsScript (since Qt 5.1)
|
31
|
|
QLocale::ElbasanScript (since Qt 5.5)
|
32
|
|
QLocale::EthiopicScript
|
33
|
|
QLocale::FraserScript (since Qt 5.1)
|
34
|
|
QLocale::GeorgianScript
|
35
|
|
QLocale::GlagoliticScript (since Qt 5.1)
|
36
|
|
QLocale::GothicScript (since Qt 5.1)
|
37
|
|
QLocale::GranthaScript (since Qt 5.5)
|
38
|
|
QLocale::GreekScript
|
39
|
|
QLocale::GujaratiScript
|
40
|
|
QLocale::GurmukhiScript
|
41
|
|
QLocale::HangulScript (since Qt 5.1)
|
42
|
|
QLocale::HanifiScript (since Qt 6.6)
|
142
|
|
QLocale::HanScript (since Qt 5.1)
|
43
|
|
QLocale::HanunooScript (since Qt 5.1)
|
44
|
|
QLocale::HanWithBopomofoScript (since Qt 5.7)
|
45
|
|
QLocale::HatranScript (since Qt 5.7)
|
46
|
|
QLocale::HebrewScript
|
47
|
|
QLocale::HiraganaScript (since Qt 5.1)
|
48
|
|
QLocale::ImperialAramaicScript (since Qt 5.1)
|
49
|
|
QLocale::InscriptionalPahlaviScript (since Qt 5.1)
|
50
|
|
QLocale::InscriptionalParthianScript (since Qt 5.1)
|
51
|
|
QLocale::JamoScript (since Qt 5.7)
|
52
|
|
QLocale::JapaneseScript
|
53
|
|
QLocale::JavaneseScript (since Qt 5.1)
|
54
|
|
QLocale::KaithiScript (since Qt 5.1)
|
55
|
|
QLocale::KannadaScript
|
56
|
|
QLocale::KatakanaScript (since Qt 5.1)
|
57
|
|
QLocale::KayahLiScript (since Qt 5.1)
|
58
|
|
QLocale::KharoshthiScript (since Qt 5.1)
|
59
|
|
QLocale::KhmerScript (since Qt 5.1)
|
60
|
|
QLocale::KhojkiScript (since Qt 5.5)
|
61
|
|
QLocale::KhudawadiScript (since Qt 5.5)
|
62
|
|
QLocale::KoreanScript
|
63
|
|
QLocale::LannaScript (since Qt 5.1)
|
64
|
|
QLocale::LaoScript
|
65
|
|
QLocale::LatinScript
|
66
|
|
QLocale::LepchaScript (since Qt 5.1)
|
67
|
|
QLocale::LimbuScript (since Qt 5.1)
|
68
|
|
QLocale::LinearAScript (since Qt 5.5)
|
69
|
|
QLocale::LinearBScript (since Qt 5.1)
|
70
|
|
QLocale::LycianScript (since Qt 5.1)
|
71
|
|
QLocale::LydianScript (since Qt 5.1)
|
72
|
|
QLocale::MahajaniScript (since Qt 5.5)
|
73
|
|
QLocale::MalayalamScript
|
74
|
|
QLocale::MandaeanScript (since Qt 5.1)
|
75
|
|
QLocale::ManichaeanScript (since Qt 5.5)
|
76
|
|
QLocale::MarchenScript (since Qt 5.7)
|
77
|
|
QLocale::MeiteiMayekScript (since Qt 5.1)
|
78
|
|
QLocale::MendeScript (since Qt 6.0)
|
79
|
|
QLocale::MendeKikakuiScript
|
MendeScript
|
過時,請使用 MendeScript |
QLocale::MeroiticCursiveScript (since Qt 5.1)
|
80
|
|
QLocale::MeroiticScript (since Qt 5.1)
|
81
|
|
QLocale::ModiScript (since Qt 5.5)
|
82
|
|
QLocale::MongolianScript
|
83
|
|
QLocale::MroScript (since Qt 5.5)
|
84
|
|
QLocale::MultaniScript (since Qt 5.7)
|
85
|
|
QLocale::MyanmarScript
|
86
|
|
QLocale::NabataeanScript (since Qt 5.5)
|
87
|
|
QLocale::NewaScript (since Qt 5.7)
|
88
|
|
QLocale::NewTaiLueScript (since Qt 5.1)
|
89
|
|
QLocale::NkoScript (since Qt 5.1)
|
90
|
|
QLocale::OghamScript (since Qt 5.1)
|
92
|
|
QLocale::OlChikiScript (since Qt 5.1)
|
93
|
|
QLocale::OldHungarianScript (since Qt 5.7)
|
94
|
|
QLocale::OldItalicScript (since Qt 5.1)
|
95
|
|
QLocale::OldNorthArabianScript (since Qt 5.5)
|
96
|
|
QLocale::OldPermicScript (since Qt 5.5)
|
97
|
|
QLocale::OldPersianScript (since Qt 5.1)
|
98
|
|
QLocale::OldSouthArabianScript (since Qt 5.1)
|
99
|
|
QLocale::OdiaScript (since Qt 6.0)
|
91
|
|
QLocale::OriyaScript
|
OdiaScript
|
過時,請使用 OdiaScript |
QLocale::OrkhonScript (since Qt 5.1)
|
100
|
|
QLocale::OsageScript (since Qt 5.7)
|
101
|
|
QLocale::OsmanyaScript (since Qt 5.1)
|
102
|
|
QLocale::PahawhHmongScript (since Qt 5.5)
|
103
|
|
QLocale::PalmyreneScript (since Qt 5.5)
|
104
|
|
QLocale::PauCinHauScript (since Qt 5.5)
|
105
|
|
QLocale::PhagsPaScript (since Qt 5.1)
|
106
|
|
QLocale::PhoenicianScript (since Qt 5.1)
|
107
|
|
QLocale::PollardPhoneticScript (since Qt 5.1)
|
108
|
|
QLocale::PsalterPahlaviScript (since Qt 5.5)
|
109
|
|
QLocale::RejangScript (since Qt 5.1)
|
110
|
|
QLocale::RunicScript (since Qt 5.1)
|
111
|
|
QLocale::SamaritanScript (since Qt 5.1)
|
112
|
|
QLocale::SaurashtraScript (since Qt 5.1)
|
113
|
|
QLocale::SharadaScript (since Qt 5.1)
|
114
|
|
QLocale::ShavianScript (since Qt 5.1)
|
115
|
|
QLocale::SiddhamScript (since Qt 5.5)
|
116
|
|
QLocale::SignWritingScript (since Qt 5.7)
|
117
|
|
QLocale::SimplifiedChineseScript
|
SimplifiedHanScript
|
如同 SimplifiedHanScript |
QLocale::SimplifiedHanScript
|
118
|
如同 SimplifiedChineseScript |
QLocale::SinhalaScript
|
119
|
|
QLocale::SoraSompengScript (since Qt 5.1)
|
120
|
|
QLocale::SundaneseScript (since Qt 5.1)
|
121
|
|
QLocale::SylotiNagriScript (since Qt 5.1)
|
122
|
|
QLocale::SyriacScript
|
123
|
|
QLocale::TagalogScript (since Qt 5.1)
|
124
|
|
QLocale::TagbanwaScript (since Qt 5.1)
|
125
|
|
QLocale::TaiLeScript (since Qt 5.1)
|
126
|
|
QLocale::TaiVietScript (since Qt 5.1)
|
127
|
|
QLocale::TakriScript (since Qt 5.1)
|
128
|
|
QLocale::TamilScript
|
129
|
|
QLocale::TangutScript (since Qt 5.7)
|
130
|
|
QLocale::TeluguScript
|
131
|
|
QLocale::ThaanaScript
|
132
|
|
QLocale::ThaiScript
|
133
|
|
QLocale::TibetanScript
|
134
|
|
QLocale::TifinaghScript
|
135
|
|
QLocale::TirhutaScript (since Qt 5.5)
|
136
|
|
QLocale::TraditionalChineseScript
|
TraditionalHanScript
|
如同 TraditionalHanScript |
QLocale::TraditionalHanScript
|
137
|
如同 TraditionalChineseScript |
QLocale::UgariticScript (since Qt 5.1)
|
138
|
|
QLocale::VaiScript
|
139
|
|
QLocale::VarangKshitiScript (since Qt 5.5)
|
140
|
|
QLocale::YiScript
|
141
|
另請參閱 script (), scriptToString (),和 languageToString ().
[since 6.7]
enum class QLocale::
TagSeparator
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.
| 常量 | 值 | 描述 |
|---|---|---|
QLocale::TagSeparator::Dash
|
'-'
|
使用
'-'
, the dash or hyphen character.
|
QLocale::TagSeparator::Underscore
|
'_'
|
使用
'_'
, the underscore character.
|
注意: Although dash and underscore are the only separators used in public standards (as at 2023), it is possible to cast any ASCII character to this type if a non-standard ASCII separator is needed. Casting a non-ASCII character (with decimal value above 127) is not supported: such values are reserved for future use as enum members if some public standard ever uses a non-ASCII separator. It is, of course, possible to use QString::replace () to replace the separator used by a function taking a parameter of this type with an arbitrary Unicode character or string.
該枚舉在 Qt 6.7 引入。
[alias]
QLocale::
Territory
此枚舉類型是彆名化的 Country , which shall be renamed to Territory at a future release.
另請參閱 territory () 和 territoryToString ().
Returns a string representation of the given number .
The string's length shall be at least the absolute value of
fieldWidth
,使用
fillChar
as padding if the
number
has fewer digits. If
fillChar
is
'0'
the zero digit of this locale is used as padding. If
fieldWidth
is negative the string starts with its representation of
number
and, if shorter, is padded to length
-fieldWidth
采用給定
fillChar
. For positive fieldWidth, the padding appears before the representation of
number
. When the
number
is negative and
fieldWidth
is positive, if
fillChar
是
'0'
the padding is inserted between this locale's minus sign and the start of the number's digits.
Returns a string representation of the given number .
The string's length shall be at least the absolute value of
fieldWidth
,使用
fillChar
as padding if the
number
has fewer digits. If
fillChar
is
'0'
the zero digit of this locale is used as padding. If
fieldWidth
is negative the string starts with its representation of
number
and, if shorter, is padded to length
-fieldWidth
采用給定
fillChar
. For positive fieldWidth, the padding appears before the representation of
number
.
構造 QLocale 對象,初始化采用默認區域設置。
If no default locale was set using setDefault (), this locale will be the same as the one returned by system ().
另請參閱 setDefault () 和 system ().
[explicit, since 6.3]
QLocale::
QLocale
(
QStringView
name
)
構造 QLocale 對象采用指定 name .
The name has the format "language[_script][_territory][.codeset][@modifier]" or "C", where:
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).
該函數在 Qt 6.3 引入。
另請參閱 bcp47Name () 和 語言、腳本和地區的匹配組閤 .
構造 QLocale 對象為指定 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.
另請參閱 setDefault () 和 語言、腳本和地區的匹配組閤 .
構造 QLocale 對象為指定 language , script and territory .
若 QLocale 沒有針對給定組閤的數據,就會查找盡可能好的匹配數據 (若它可以)。它會迴退到默認區域設置若
AnyLanguage
且無法推斷語言從
script
and
territory
另請參閱 setDefault () 和 語言、腳本和地區的匹配組閤 .
[explicit]
QLocale::
QLocale
(const
QString
&
name
)
這是重載函數。
[noexcept]
QLocale::
QLocale
(const
QLocale
&
other
)
構造 QLocale 對象作為副本為 other .
[noexcept]
QLocale::
~QLocale
()
析構函數
Returns the localized name of the "AM" suffix for times specified using the conventions of the 12-hour clock.
另請參閱 pmText ().
返迴采用 - 連接的 BCP47 字段名。
需要將這與很多語言、腳本和地區 (且可能有其它 BCP47 字段) 組閤,以指定唯一區域設置。注意,字段可能被省略若 Unicode 聯盟的 可能的子標簽規則 暗示省略字段,當給定保留的那些時。見 name () 瞭解如何從單個字段構造字符串,若需要某些其它格式。
不像 uiLanguages (),由 bcp47Name() 返迴的值錶示的是區域設置名稱對於 QLocale 數據;這不應該是用戶界麵需要的語言。
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.
另請參閱 name (), language (), territory (), script (),和 uiLanguages ().
[static]
QLocale
QLocale::
c
()
返迴 QLocale 對象被初始化成 C 區域設置。
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).
另請參閱 system ().
[static noexcept, since 6.3]
QLocale::Language
QLocale::
codeToLanguage
(
QStringView
languageCode
,
QLocale::LanguageCodeTypes
codeTypes
= AnyLanguageCode)
返迴 QLocale::Language enum corresponding to the two- or three-letter languageCode , as defined in the ISO 639 standards.
若指定,
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
.
若代碼無效或未知
QLocale::AnyLanguage
被返迴。
該函數在 Qt 6.3 引入。
另請參閱 languageToCode (), codeToTerritory (),和 codeToScript ().
[static noexcept, since 6.1]
QLocale::Script
QLocale::
codeToScript
(
QStringView
scriptCode
)
返迴 QLocale::Script enum corresponding to the four-letter script scriptCode , 如 ISO 15924 標準定義的。
若代碼無效或未知 QLocale::AnyScript 被返迴。
該函數在 Qt 6.1 引入。
另請參閱 scriptToCode (), codeToLanguage (),和 codeToTerritory ().
[static noexcept, since 6.2]
QLocale::Territory
QLocale::
codeToTerritory
(
QStringView
territoryCode
)
返迴 QLocale::Territory enum corresponding to the two-letter or three-digit territoryCode ,如 ISO 3166 標準定義的。
若代碼無效或未知 QLocale::AnyTerritory 被返迴。
該函數在 Qt 6.2 引入。
另請參閱 territoryToCode (), codeToLanguage (),和 codeToScript ().
返迴用於整理的區域設置。
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 的構造函數。
另請參閱 QCollator .
Returns a string that represents a join of a given list of strings with a separator defined by the locale.
返迴貨幣符號根據 format .
Returns the date format used for the current locale.
若
format
is
LongFormat
, the format will be elaborate, otherwise it will be short. For example,
LongFormat
為
en_US
locale is
dddd, MMMM d, yyyy
,
ShortFormat
is
M/d/yy
.
另請參閱 QDate::toString () 和 QDate::fromString ().
Returns the date time format used for the current locale.
若
format
is
LongFormat
, the format will be elaborate, otherwise it will be short. For example,
LongFormat
為
en_US
locale is
dddd, MMMM d, yyyy h:mm:ss AP t
,
ShortFormat
is
M/d/yy h:mm AP
.
另請參閱 QDateTime::toString () 和 QDateTime::fromString ().
Returns the localized name of the day (where 1 represents Monday, 2 represents Tuesday and so on), in the format specified by type .
例如,若區域設置為
en_US
and
day
is 1,
LongFormat
將返迴
Monday
,
ShortFormat
Mon
,和
NarrowFormat
M
.
另請參閱 monthName () 和 standaloneDayName ().
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.
另請參閱 groupSeparator () 和 toString ().
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.
另請參閱 toString (double, char, int).
Returns the first day of the week according to the current locale.
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
DataSizeIecFormat
(the default), this function returns "16.00 KiB"; for 1330409069609 bytes it returns "1.21 GiB"; and so on. If
format
is
DataSizeIecFormat
or
DataSizeTraditionalFormat
, the given number of bytes is divided by a power of 1024, with result less than 1024; for
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.
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.
另請參閱 decimalPoint () 和 toString ().
返迴此區域設置的語言。
另請參閱 script (), territory (), languageToString (),和 bcp47Name ().
[static, since 6.3]
QString
QLocale::
languageToCode
(
QLocale::Language
語言
,
QLocale::LanguageCodeTypes
codeTypes
= AnyLanguageCode)
Returns the two- or three-letter language code for language , as defined in the ISO 639 standards.
若指定,
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.
注意:
For
QLocale::C
函數返迴
"C"
。對於
QLocale::AnyLanguage
an empty string is returned. If the language has no code in any selected code set, an empty string is returned.
該函數在 Qt 6.3 引入。
另請參閱 codeToLanguage (), language (), name (), bcp47Name (), territoryToCode (),和 scriptToCode ().
[static]
QString
QLocale::
languageToString
(
QLocale::Language
語言
)
返迴 QString 包含名稱對於 language .
另請參閱 territoryToString (), scriptToString (),和 bcp47Name ().
[static]
QList
<
QLocale
> QLocale::
matchingLocales
(
QLocale::Language
語言
,
QLocale::Script
script
,
QLocale::Territory
territory
)
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 );
返迴區域設置的度量係統。
返迴本地化名稱為 month ,按格式指定通過 type .
例如,若區域設置為
en_US
and
month
is 1,
LongFormat
將返迴
January
.
ShortFormat
Jan
,和
NarrowFormat
J
.
另請參閱 dayName () 和 standaloneMonthName ().
此區域設置的短名稱。
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 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 language () 到 languageToCode () and similar for the script and territory.
另請參閱 QLocale (), language (), script (), territory (), bcp47Name (),和 uiLanguages ().
Returns a native name of the language for the locale. For example "Schweizer Hochdeutsch" for the Swiss-German locale.
另請參閱 nativeTerritoryName () 和 languageToString ().
[since 6.2]
QString
QLocale::
nativeTerritoryName
() const
Returns a native name of the territory for the locale. For example "España" for Spanish/Spain locale.
該函數在 Qt 6.2 引入。
另請參閱 nativeLanguageName () 和 territoryToString ().
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.
另請參閱 positiveSign () 和 toString ().
Returns the options related to number conversions for this QLocale 實例。
By default, no options are set for the standard locales, except for the "C" locale, which has OmitGroupSeparator set by default.
另請參閱 setNumberOptions (), toString (), groupSeparator (),和 FloatingPointPrecisionOption .
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.
另請參閱 toString ().
Returns the localized name of the "PM" suffix for times specified using the conventions of the 12-hour clock.
另請參閱 amText ().
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.
另請參閱 negativeSign () 和 toString ().
返迴 str quoted according to the current locale using the given quotation style .
[since 6.0]
QString
QLocale::
quoteString
(
QStringView
str
,
QLocale::QuotationStyle
style
= StandardQuotation) const
這是重載函數。
該函數在 Qt 6.0 引入。
返迴此區域設置的腳本。
另請參閱 language (), territory (), languageToString (), scriptToString (),和 bcp47Name ().
[static, since 6.1]
QString
QLocale::
scriptToCode
(
QLocale::Script
script
)
返迴 4 字母腳本代碼為 script , 如 ISO 15924 標準定義的。
注意:
For
QLocale::AnyScript
返迴空字符串。
該函數在 Qt 6.1 引入。
另請參閱 script (), name (), bcp47Name (), languageToCode (),和 territoryToCode ().
[static]
QString
QLocale::
scriptToString
(
QLocale::Script
script
)
返迴 QString 包含名稱對於 script .
另請參閱 languageToString (), territoryToString (), script (),和 bcp47Name ().
[static]
void
QLocale::
setDefault
(const
QLocale
&
locale
)
將全局默認區域設置設為 locale .
This locale is used when a QLocale object is constructed with no arguments. If this function is not called, the system's locale is used.
警告: In a multithreaded application, the default locale should be set at application startup, before any non-GUI threads are created.
警告: 此函數不 可重入 .
設置 options related to number conversions for this QLocale 實例。
另請參閱 numberOptions () 和 FloatingPointPrecisionOption .
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 ().
另請參閱 dayName () 和 standaloneMonthName ().
返迴本地化名稱為 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 ().
另請參閱 monthName () 和 standaloneDayName ().
[noexcept]
void
QLocale::
swap
(
QLocale
&
other
)
Swaps this locale with other 。此操作很快且從不失敗。
[static]
QLocale
QLocale::
system
()
返迴 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.
另請參閱 c ().
[since 6.2]
QLocale::Territory
QLocale::
territory
() const
返迴此區域設置的地區。
該函數在 Qt 6.2 引入。
另請參閱 language (), script (), territoryToString (),和 bcp47Name ().
[static, since 6.2]
QString
QLocale::
territoryToCode
(
QLocale::Territory
territory
)
返迴 2 字母地區代碼為 territory ,如 ISO 3166 標準定義的。
注意:
For
QLocale::AnyTerritory
返迴空字符串。
該函數在 Qt 6.2 引入。
另請參閱 codeToTerritory (), territory (), name (), bcp47Name (), languageToCode (),和 scriptToCode ().
[static, since 6.2]
QString
QLocale::
territoryToString
(
QLocale::Territory
territory
)
返迴 QString 包含名稱對於 territory .
該函數在 Qt 6.2 引入。
另請參閱 languageToString (), scriptToString (), territory (),和 bcp47Name ().
返迴語言的文本方嚮。
返迴用於當前區域設置的時間格式。
若
format
is
LongFormat
, the format will be elaborate, otherwise it will be short. For example,
LongFormat
為
en_US
locale is
h:mm:ss AP t
,
ShortFormat
is
h:mm AP
.
另請參閱 QTime::toString () 和 QTime::fromString ().
返迴本地化字符串錶示為 value 以貨幣方式。若 symbol is provided it is used instead of the default currency symbol.
另請參閱 currencySymbol ().
這是重載函數。
這是重載函數。
這是重載函數。
這是重載函數。
這是重載函數。
返迴本地化字符串錶示為 value 以貨幣方式。若 symbol is provided it is used instead of the default currency symbol. If the precision is provided it is used to set the precision of the currency value.
此函數重載 QLocale::toCurrencyString ().
另請參閱 currencySymbol ().
此函數重載 QLocale::toCurrencyString ().
讀取 string as a date in a locale-specific format .
剖析 string and returns the date it represents. The format of the date string is chosen according to the format 參數 (見 dateFormat ()).
Some locales use, particularly for ShortFormat , only the last two digits of the year. In such a case, the 100 years starting at baseYear are the candidates first considered. Prior to 6.7 there was no baseYear parameter and 1900 was always used. This is the default for baseYear , selecting a year from then to 1999. In some cases, other fields may lead to the next or previous century being selected, to get a result consistent with all fields given. See QDate::fromString () 瞭解細節。
注意: Month and day names, where used, must be given in the locale's language.
If the date could not be parsed, returns an invalid date.
另請參閱 dateFormat (), toTime (), toDateTime (),和 QDate::fromString ().
讀取 string as a date in the given format .
剖析 string and returns the date it represents. See QDate::fromString () for the interpretation of format .
當 format only specifies the last two digits of a year, the 100 years starting at baseYear are the candidates first considered. Prior to 6.7 there was no baseYear parameter and 1900 was always used. This is the default for baseYear , selecting a year from then to 1999. In some cases, other fields may lead to the next or previous century being selected, to get a result consistent with all fields given. See QDate::fromString () 瞭解細節。
注意: Month and day names, where used, must be given in the locale's language.
If the date could not be parsed, returns an invalid date.
另請參閱 dateFormat (), toTime (), toDateTime (),和 QDate::fromString ().
這是重載函數。
這是重載函數。
讀取 string as a date-time in a locale-specific format .
剖析 string and returns the date-time it represents. The format of the date string is chosen according to the format 參數 (見 dateFormat ()).
Some locales use, particularly for ShortFormat , only the last two digits of the year. In such a case, the 100 years starting at baseYear are the candidates first considered. Prior to 6.7 there was no baseYear parameter and 1900 was always used. This is the default for baseYear , selecting a year from then to 1999. In some cases, other fields may lead to the next or previous century being selected, to get a result consistent with all fields given. See QDate::fromString () 瞭解細節。
注意: Month and day names, where used, must be given in the locale's language. Any am/pm indicators used must match amText () 或 pmText (),忽略大小寫。
If the string could not be parsed, returns an invalid QDateTime .
另請參閱 dateTimeFormat (), toTime (), toDate (),和 QDateTime::fromString ().
讀取 string as a date-time in the given format .
剖析 string and returns the date-time it represents. See QDateTime::fromString () for the interpretation of format .
當 format only specifies the last two digits of a year, the 100 years starting at baseYear are the candidates first considered. Prior to 6.7 there was no baseYear parameter and 1900 was always used. This is the default for baseYear , selecting a year from then to 1999. In some cases, other fields may lead to the next or previous century being selected, to get a result consistent with all fields given. See QDate::fromString () 瞭解細節。
注意: Month and day names, where used, must be given in the locale's language. Any am/pm indicators used must match amText () 或 pmText (),忽略大小寫。
If the string could not be parsed, returns an invalid QDateTime . If the string can be parsed and represents an invalid date-time (e.g. in a gap skipped by a time-zone transition), an invalid QDateTime is returned, whose toMSecsSinceEpoch() represents a near-by date-time that is valid. Passing that to fromMSecsSinceEpoch() will produce a valid date-time that isn't faithfully represented by the string parsed.
另請參閱 dateTimeFormat (), toTime (), toDate (),和 QDateTime::fromString ().
這是重載函數。
這是重載函數。
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).
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
bool ok; double d; QLocale c(QLocale::C); d = c.toDouble(u"1234.56", &ok); // ok == true, d == 1234.56 d = c.toDouble(u"1,234.56", &ok); // ok == true, d == 1234.56 d = c.toDouble(u"1234,56", &ok); // ok == false, d == 0 QLocale german(QLocale::German); d = german.toDouble(u"1234,56", &ok); // ok == true, d == 1234.56 d = german.toDouble(u"1.234,56", &ok); // ok == true, d == 1234.56 d = german.toDouble(u"1234.56", &ok); // ok == false, d == 0 d = german.toDouble(u"1.234", &ok); // ok == true, d == 1234.0
Notice that the last conversion returns 1234.0, because '.' is the thousands group separator in the German locale.
此函數忽略前導和結尾空格。
另請參閱 toFloat (), toInt (),和 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).
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
bool ok; double d; QLocale c(QLocale::C); d = c.toDouble("1234.56", &ok); // ok == true, d == 1234.56 d = c.toDouble("1,234.56", &ok); // ok == true, d == 1234.56 d = c.toDouble("1234,56", &ok); // ok == false, d == 0 QLocale german(QLocale::German); d = german.toDouble("1234,56", &ok); // ok == true, d == 1234.56 d = german.toDouble("1.234,56", &ok); // ok == true, d == 1234.56 d = german.toDouble("1234.56", &ok); // ok == false, d == 0 d = german.toDouble("1.234", &ok); // ok == true, d == 1234.0
Notice that the last conversion returns 1234.0, because '.' is the thousands group separator in the German locale.
此函數忽略前導和結尾空格。
另請參閱 toFloat (), toInt (),和 toString ().
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).
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toDouble (), toInt (),和 toString ().
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).
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toDouble (), toInt (),和 toString ().
Returns the int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
Returns the int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
Returns the long int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toInt (), toULong (), toDouble (),和 toString ().
Returns the long int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toInt (), toULong (), toDouble (),和 toString ().
Returns the long long int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toInt (), toULongLong (), toDouble (),和 toString ().
Returns the long long int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toInt (), toULongLong (), toDouble (),和 toString ().
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.
另請參閱 QString::toLower ().
Returns the short int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toUShort () 和 toString ().
Returns the short int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toUShort () 和 toString ().
返迴本地化字符串錶示為 i .
另請參閱 toLongLong (), numberOptions (), zeroDigit (),和 positiveSign ().
返迴本地化字符串錶示為給定 date 以指定 format 。若 format 是空字符串,返迴空字符串。
另請參閱 QDate::toString ().
返迴本地化字符串錶示為給定 time 以指定 format (見 timeFormat ()).
返迴本地化字符串錶示為給定 time 根據指定 format 。若 format 是空字符串,返迴空字符串。
另請參閱 QTime::toString ().
返迴本地化字符串錶示為給定 time 根據指定 format 。若 format 是空字符串,返迴空字符串。
另請參閱 QTime::toString ().
返迴本地化字符串錶示為給定 dateTime 根據指定 format 。若 format 是空字符串,返迴空字符串。
另請參閱 QDateTime::toString (), QDate::toString (),和 QTime::toString ().
返迴本地化字符串錶示為給定 date 根據指定 format (見 dateFormat ()), optionally for a specified calendar cal .
注意: Some locales may use formats that limit the range of years they can represent.
返迴本地化字符串錶示為給定 date 以指定 format , optionally for a specified calendar cal 。若 format 是空字符串,返迴空字符串。
另請參閱 QDate::toString ().
返迴本地化字符串錶示為給定 dateTime 根據指定 format (見 dateTimeFormat ()), optionally for a specified calendar cal .
注意: Some locales may use formats that limit the range of years they can represent.
返迴本地化字符串錶示為給定 dateTime 根據指定 format , optionally for a specified calendar cal 。若 format 是空字符串,返迴空字符串。
另請參閱 QDateTime::toString (), QDate::toString (),和 QTime::toString ().
這是重載函數。
另請參閱 toInt ().
這是重載函數。
另請參閱 toLong ().
這是重載函數。
另請參閱 toULongLong (), numberOptions (), zeroDigit (),和 positiveSign ().
這是重載函數。
另請參閱 toShort ().
這是重載函數。
另請參閱 toUInt ().
這是重載函數。
另請參閱 toULong ().
這是重載函數。
另請參閱 toUShort ().
這是重載函數。
這是重載函數。
這是重載函數。
這是重載函數。
Returns a string representing the floating-point number f .
The form of the representation is controlled by the format and precision 參數。
The
format
默認為
'g'
。它可以是下列任一:
| 格式 | 含義 | Meaning of precision |
|---|---|---|
'e'
|
format as [-]9.9e[+|-]999 | number of digits after the decimal point |
'E'
|
format as [-]9.9E[+|-]999 | " |
'f'
|
format as [-]9.9 | " |
'F'
|
如同
'f'
except for INF and NAN (see below)
|
" |
'g'
|
使用
'e'
or
'f'
format, whichever is more concise
|
maximum number of significant digits (trailing zeroes are omitted) |
'G'
|
使用
'E'
or
'F'
format, whichever is more concise
|
" |
特殊 precision 值 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.
對於
'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.
這是重載函數。
另請參閱 toDouble (), numberOptions (), exponential (), decimalPoint (), zeroDigit (), positiveSign (), percent (), toCurrencyString (), formattedDataSize (),和 QLocale::FloatingPointPrecisionOption .
Returns a string representing the floating-point number f .
The format and precision have the same meanings as described in toString (double, char, int).
這是重載函數。
另請參閱 toFloat (), toDouble (), numberOptions (), exponential (), decimalPoint (), zeroDigit (), positiveSign (), percent (), toCurrencyString (), formattedDataSize (),和 QLocale::FloatingPointPrecisionOption .
Returns a string representation of the given number .
The string's length shall be at least the absolute value of
fieldWidth
,使用
fillChar
as padding if the
number
has fewer digits. If
fillChar
is
'0'
the zero digit of this locale is used as padding. If
fieldWidth
is negative the string starts with its representation of
number
and, if shorter, is padded to length
-fieldWidth
采用給定
fillChar
. For positive fieldWidth, the padding appears before the representation of
number
. When the
number
is negative and
fieldWidth
is positive, if
fillChar
是
'0'
the padding is inserted between this locale's minus sign and the start of the number's digits.
此函數重載 QLocale::toString ().
Returns a string representation of the given number .
The string's length shall be at least the absolute value of
fieldWidth
,使用
fillChar
as padding if the
number
has fewer digits. If
fillChar
is
'0'
the zero digit of this locale is used as padding. If
fieldWidth
is negative the string starts with its representation of
number
and, if shorter, is padded to length
-fieldWidth
采用給定
fillChar
. For positive fieldWidth, the padding appears before the representation of
number
.
此函數重載 QLocale::toString ().
讀取 string as a time in a locale-specific format .
剖析 string and returns the time it represents. The format of the time string is chosen according to the format 參數 (見 timeFormat ()).
注意: Any am/pm indicators used must match amText () 或 pmText (),忽略大小寫。
If the time could not be parsed, returns an invalid time.
另請參閱 timeFormat (), toDate (), toDateTime (),和 QTime::fromString ().
讀取 string as a time in the given format .
剖析 string and returns the time it represents. See QTime::fromString () for the interpretation of format .
注意: Any am/pm indicators used must match amText () 或 pmText (),忽略大小寫。
If the time could not be parsed, returns an invalid time.
另請參閱 timeFormat (), toDate (), toDateTime (),和 QTime::fromString ().
Returns the unsigned int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
Returns the unsigned int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
Returns the unsigned long int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toLong (), toInt (), toDouble (),和 toString ().
Returns the unsigned long int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toLong (), toInt (), toDouble (),和 toString ().
Returns the unsigned long long int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toLongLong (), toInt (), toDouble (),和 toString ().
Returns the unsigned long long int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toLongLong (), toInt (), toDouble (),和 toString ().
Returns the unsigned short int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toShort () 和 toString ().
Returns the unsigned short int represented by the localized string s .
若轉換失敗,函數返迴 0。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
此函數忽略前導和結尾空格。
另請參閱 toShort () 和 toString ().
返迴大寫副本的 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.
注意: In some cases the uppercase form of a string may be longer than the original.
另請參閱 QString::toUpper ().
用於選擇翻譯的區域設置名稱的列錶
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-Latn", "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 (or other resources specific to locale) use underscores, rather than dashes, to separate locale tags, pass QLocale::TagSeparator::Underscore as separator .
Returns a list of locale names. This may include multiple languages, especially for the system locale when multiple UI translation languages are configured. The order of entries is significant. For example, for the system locale, it reflects user preferences.
Prior to Qt 6.9, the list only contained explicitly configured locales and their equivalents. This led some callers to add truncations (such as from 'en-Latn-DE' to 'en') as fallbacks. This could sometimes result in inappropriate choices, especially if these were tried before later entries that would be more appropriate fallbacks.
Starting from Qt 6.9, reasonable truncations are included in the returned list after all entries equivalent to the explicitly specified locales. This change allows for more accurate fallback options without callers needing to do any truncation.
Users can explicitly include preferred fallback locales (such as en-US) in their system configuration to control the order of preference. You are advised to rely on the order of entries in uiLanguages() rather than using custom fallback methods.
Most likely you do not need to use this function directly, but just pass the QLocale 對象到 QTranslator::load () 函數。
另請參閱 QTranslator and bcp47Name ().
Returns a list of days that are considered weekdays according to the current locale.
返迴此區域設置的 0 數字字符。
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.
另請參閱 toString ().
[noexcept]
QLocale
&QLocale::
operator=
(const
QLocale
&
other
)
賦值 other 到此 QLocale 對象並返迴引用為此 QLocale 對象。
[since 6.7]
const
int
QLocale::
DefaultTwoDigitBaseYear
This variable holds 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.
This variable was introduced in Qt 6.7.
另請參閱 toDate (), toDateTime (), QDate::fromString (),和 QDateTime::fromString ().
[noexcept]
size_t
qHash
(const
QLocale
&
key
,
size_t
seed
= 0)
返迴哈希值為 key ,使用 seed 做計算種子。
[noexcept]
bool
operator!=
(const
QLocale
&
lhs
, const
QLocale
&
rhs
)
返迴
true
若兩
QLocale
對象,
lhs
and
rhs
不同;否則返迴
false
.
注意: 係統區域設置不等於 QLocale 對象構造從其 language (), script () 和 territory (), even if the two agree in all data fields. Nor are two locales with different number options equal.
另請參閱 operator== () 和 setNumberOptions ().
[noexcept]
bool
operator==
(const
QLocale
&
lhs
, const
QLocale
&
rhs
)
返迴
true
若兩
QLocale
對象,
lhs
and
rhs
相同;否則返迴
false
.
注意: 係統區域設置不等於 QLocale 對象構造從其 language (), script () 和 territory (), even if the two agree in all data fields. Nor are two locales with different number options equal.
另請參閱 operator!= () 和 setNumberOptions ().