QLocale 类在各种语言的数字及其字符串表示之间转换。 更多...
头: | #include <QLocale> |
qmake: | QT += core |
注意: 此类的所有函数 可重入 除以下外:
enum | Country { AnyCountry, Afghanistan, AlandIslands, Albania, Algeria, …, Zimbabwe } |
enum | CurrencySymbolFormat { CurrencyIsoCode, CurrencySymbol, CurrencyDisplayName } |
enum | DataSizeFormat { DataSizeIecFormat, DataSizeTraditionalFormat, DataSizeSIFormat } |
flags | DataSizeFormats |
enum | FloatingPointPrecisionOption { FloatingPointShortest } |
enum | FormatType { LongFormat, ShortFormat, NarrowFormat } |
enum | 语言 { AnyLanguage, C, Abkhazian, Afan, Afar, …, Zulu } |
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 } |
QLocale (const QLocale & other ) | |
QLocale (QLocale::Language 语言 , QLocale::Script script , QLocale::Country country ) | |
QLocale (QLocale::Language 语言 , QLocale::Country country = AnyCountry) | |
QLocale (const QString & name ) | |
QLocale () | |
QLocale & | operator= (const QLocale & other ) |
~QLocale () | |
QString | amText () const |
QString | bcp47Name () const |
QLocale | collation () const |
QLocale::Country | country () 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 |
QChar | decimalPoint () const |
QChar | exponential () const |
Qt::DayOfWeek | firstDayOfWeek () const |
QString | formattedDataSize (qint64 bytes , int precision = 2, QLocale::DataSizeFormats format = DataSizeIecFormat) const |
QChar | groupSeparator () const |
QLocale::Language | 语言 () const |
QLocale::MeasurementSystem | measurementSystem () const |
QString | monthName (int month , QLocale::FormatType type = LongFormat) const |
QString | name () const |
QString | nativeCountryName () const |
QString | nativeLanguageName () const |
QChar | negativeSign () const |
QLocale::NumberOptions | numberOptions () const |
QChar | percent () const |
QString | pmText () const |
QChar | positiveSign () const |
QString | quoteString (const QString & str , QLocale::QuotationStyle style = StandardQuotation) const |
QString | quoteString (const QStringRef & 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 ) |
Qt::LayoutDirection | textDirection () const |
QString | timeFormat (QLocale::FormatType format = LongFormat) const |
QString | toCurrencyString (qlonglong 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 (ushort value , const QString & symbol = QString()) const |
QString | toCurrencyString (int value , const QString & symbol = QString()) const |
QString | toCurrencyString (uint value , const QString & symbol = QString()) const |
QString | toCurrencyString (double value , const QString & symbol = QString()) const |
QString | toCurrencyString (double value , const QString & symbol , int precision ) const |
QString | toCurrencyString (float value , const QString & symbol = QString()) const |
QString | toCurrencyString (float i , const QString & symbol , int precision ) const |
QDate | toDate (const QString & string , QLocale::FormatType format = LongFormat) const |
QDate | toDate (const QString & string , const QString & format ) const |
QDate | toDate (const QString & string , QLocale::FormatType format , QCalendar cal ) const |
QDate | toDate (const QString & string , const QString & format , QCalendar cal ) const |
QDateTime | toDateTime (const QString & string , QLocale::FormatType format = LongFormat) const |
QDateTime | toDateTime (const QString & string , const QString & format ) const |
QDateTime | toDateTime (const QString & string , QLocale::FormatType format , QCalendar cal ) const |
QDateTime | toDateTime (const QString & string , const QString & format , QCalendar cal ) const |
double | toDouble (const QString & s , bool * ok = nullptr) const |
double | toDouble (const QStringRef & s , bool * ok = nullptr) const |
double | toDouble (QStringView s , bool * ok = nullptr) const |
float | toFloat (const QString & s , bool * ok = nullptr) const |
float | toFloat (const QStringRef & s , bool * ok = nullptr) const |
float | toFloat (QStringView s , bool * ok = nullptr) const |
int | toInt (const QString & s , bool * ok = nullptr) const |
int | toInt (const QStringRef & s , bool * ok = nullptr) const |
int | toInt (QStringView s , bool * ok = nullptr) const |
long | toLong (const QString & s , bool * ok = nullptr) const |
long | toLong (const QStringRef & s , bool * ok = nullptr) const |
long | toLong (QStringView s , bool * ok = nullptr) const |
qlonglong | toLongLong (const QString & s , bool * ok = nullptr) const |
qlonglong | toLongLong (const QStringRef & s , bool * ok = nullptr) const |
qlonglong | toLongLong (QStringView s , bool * ok = nullptr) const |
QString | toLower (const QString & str ) const |
short | toShort (const QString & s , bool * ok = nullptr) const |
short | toShort (const QStringRef & s , bool * ok = nullptr) const |
short | toShort (QStringView s , bool * ok = nullptr) const |
QString | toString (qlonglong i ) const |
QString | toString (qulonglong i ) const |
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 i , char f = 'g', int prec = 6) const |
QString | toString (float i , char f = 'g', int prec = 6) const |
QString | toString (const QDate & date , const QString & format ) const |
QString | toString (const QTime & time , const QString & format ) const |
QString | toString (const QDateTime & dateTime , const QString & format ) const |
QString | toString (const QDate & date , QStringView format ) const |
QString | toString (const QTime & time , QStringView format ) const |
QString | toString (const QDateTime & dateTime , QStringView format ) const |
QString | toString (const QDate & date , QLocale::FormatType format = LongFormat) const |
QString | toString (const QTime & time , QLocale::FormatType format = LongFormat) const |
QString | toString (const QDateTime & dateTime , QLocale::FormatType format = LongFormat) const |
QString | toString (const QDate & date , QStringView format , QCalendar cal ) const |
QString | toString (const QDate & date , QLocale::FormatType 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 |
QTime | toTime (const QString & string , QLocale::FormatType format = LongFormat) const |
QTime | toTime (const QString & string , const QString & format ) const |
uint | toUInt (const QString & s , bool * ok = nullptr) const |
uint | toUInt (const QStringRef & s , bool * ok = nullptr) const |
uint | toUInt (QStringView s , bool * ok = nullptr) const |
ulong | toULong (const QString & s , bool * ok = nullptr) const |
ulong | toULong (const QStringRef & s , bool * ok = nullptr) const |
ulong | toULong (QStringView s , bool * ok = nullptr) const |
qulonglong | toULongLong (const QString & s , bool * ok = nullptr) const |
qulonglong | toULongLong (const QStringRef & s , bool * ok = nullptr) const |
qulonglong | toULongLong (QStringView s , bool * ok = nullptr) const |
ushort | toUShort (const QString & s , bool * ok = nullptr) const |
ushort | toUShort (const QStringRef & s , bool * ok = nullptr) const |
ushort | toUShort (QStringView s , bool * ok = nullptr) const |
QString | toUpper (const QString & str ) const |
QStringList | uiLanguages () const |
QList<Qt::DayOfWeek> | weekdays () const |
QChar | zeroDigit () const |
bool | operator!= (const QLocale & other ) const |
bool | operator== (const QLocale & other ) const |
QLocale | c () |
QString | countryToString (QLocale::Country country ) |
QString | languageToString (QLocale::Language 语言 ) |
QList<QLocale> | matchingLocales (QLocale::Language 语言 , QLocale::Script script , QLocale::Country country ) |
QString | scriptToString (QLocale::Script script ) |
void | setDefault (const QLocale & locale ) |
QLocale | system () |
uint | qHash (const QLocale & key , uint seed = 0) |
QLocale is initialized with a language/country pair in its constructor and offers number-to-string and string-to-number conversion functions similar to those in QString .
范例:
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:
QLocale::setDefault(QLocale(QLocale::Hebrew, QLocale::Israel)); QLocale hebrew; // Constructs a default QLocale QString s1 = hebrew.toString(15714.3, 'e'); bool ok; double d; QLocale::setDefault(QLocale::C); d = QString("1234,56").toDouble(&ok); // ok == false, d == 0 d = QString("1234.56").toDouble(&ok); // ok == true, d == 1234.56 QLocale::setDefault(QLocale::German); d = QString("1234,56").toDouble(&ok); // ok == false, d == 0 d = QString("1234.56").toDouble(&ok); // ok == true, d == 1234.56 QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); QString str = QString("%1 %L2 %L3") .arg(12345).arg(12345).arg(12345, 0, 16); // str == "12345 12,345 3039"
When a language/country pair is specified in the constructor, one of three things can happen:
AnyCountry
, the language is used with the most appropriate available country (for example, Germany for German),
使用 语言 () 和 country () to determine the actual language and country values used.
构造 QLocale 对象的替代方法是通过指定区域设置名称。
QLocale korean("ko"); QLocale swiss("de_CH");
This constructor converts the locale name to a language/country pair; it does not use the system locale database.
注意: 对于当前键盘输入区域设置,请查看 QInputMethod::locale ().
QLocale's data is based on Common Locale Data Repository v39.
另请参阅 QString::arg (), QString::toInt (), QString::toDouble (),和 QInputMethod::locale ().
此枚举类型用于指定国家。
常量 | 值 | 描述 |
---|---|---|
QLocale::AnyCountry
|
0
|
|
QLocale::Afghanistan
|
1
|
|
QLocale::AlandIslands
|
248
|
|
QLocale::Albania
|
2
|
|
QLocale::Algeria
|
3
|
|
QLocale::AmericanSamoa
|
4
|
|
QLocale::Andorra
|
5
|
|
QLocale::Angola
|
6
|
|
QLocale::Anguilla
|
7
|
|
QLocale::Antarctica
|
8
|
|
QLocale::AntiguaAndBarbuda
|
9
|
|
QLocale::Argentina
|
10
|
|
QLocale::Armenia
|
11
|
|
QLocale::Aruba
|
12
|
|
QLocale::AscensionIsland
|
247
|
|
QLocale::Australia
|
13
|
|
QLocale::Austria
|
14
|
|
QLocale::Azerbaijan
|
15
|
|
QLocale::Bahamas
|
16
|
|
QLocale::Bahrain
|
17
|
|
QLocale::Bangladesh
|
18
|
|
QLocale::Barbados
|
19
|
|
QLocale::Belarus
|
20
|
|
QLocale::Belgium
|
21
|
|
QLocale::Belize
|
22
|
|
QLocale::Benin
|
23
|
|
QLocale::Bermuda
|
24
|
|
QLocale::Bhutan
|
25
|
|
QLocale::Bolivia
|
26
|
|
QLocale::Bonaire
|
255
|
|
QLocale::BosniaAndHerzegowina
|
27
|
|
QLocale::Botswana
|
28
|
|
QLocale::BouvetIsland
|
29
|
|
QLocale::Brazil
|
30
|
|
QLocale::BritishIndianOceanTerritory
|
31
|
|
QLocale::BritishVirginIslands
|
233
|
|
QLocale::Brunei
|
32
|
|
QLocale::Bulgaria
|
33
|
|
QLocale::BurkinaFaso
|
34
|
|
QLocale::Burundi
|
35
|
|
QLocale::Cambodia
|
36
|
|
QLocale::Cameroon
|
37
|
|
QLocale::Canada
|
38
|
|
QLocale::CanaryIslands
|
238
|
|
QLocale::CapeVerde
|
39
|
|
QLocale::CaymanIslands
|
40
|
|
QLocale::CentralAfricanRepublic
|
41
|
|
QLocale::CeutaAndMelilla
|
250
|
|
QLocale::Chad
|
42
|
|
QLocale::Chile
|
43
|
|
QLocale::China
|
44
|
|
QLocale::ChristmasIsland
|
45
|
|
QLocale::ClippertonIsland
|
241
|
|
QLocale::CocosIslands
|
46
|
|
QLocale::Colombia
|
47
|
|
QLocale::Comoros
|
48
|
|
QLocale::CongoBrazzaville
|
50
|
|
QLocale::CongoKinshasa
|
49
|
|
QLocale::CookIslands
|
51
|
|
QLocale::CostaRica
|
52
|
|
QLocale::Croatia
|
54
|
|
QLocale::Cuba
|
55
|
|
QLocale::CuraSao
|
152
|
|
QLocale::Cyprus
|
56
|
|
QLocale::CzechRepublic
|
57
|
|
QLocale::DemocraticRepublicOfCongo
|
CongoKinshasa
|
Obsolete, please use CongoKinshasa |
QLocale::DemocraticRepublicOfKorea
|
NorthKorea
|
Obsolete, please use NorthKorea |
QLocale::Denmark
|
58
|
|
QLocale::DiegoGarcia
|
249
|
|
QLocale::Djibouti
|
59
|
|
QLocale::Dominica
|
60
|
|
QLocale::DominicanRepublic
|
61
|
|
QLocale::EastTimor
|
62
|
|
QLocale::Ecuador
|
63
|
|
QLocale::Egypt
|
64
|
|
QLocale::ElSalvador
|
65
|
|
QLocale::EquatorialGuinea
|
66
|
|
QLocale::Eritrea
|
67
|
|
QLocale::Estonia
|
68
|
|
QLocale::Ethiopia
|
69
|
|
QLocale::EuropeanUnion
|
258
|
Since Qt 5.7 |
QLocale::Europe
|
261
|
Since Qt 5.12 |
QLocale::FalklandIslands
|
70
|
|
QLocale::FaroeIslands
|
71
|
|
QLocale::Fiji
|
72
|
|
QLocale::Finland
|
73
|
|
QLocale::France
|
74
|
|
QLocale::FrenchGuiana
|
76
|
|
QLocale::FrenchPolynesia
|
77
|
|
QLocale::FrenchSouthernTerritories
|
78
|
|
QLocale::Gabon
|
79
|
|
QLocale::Gambia
|
80
|
|
QLocale::Georgia
|
81
|
|
QLocale::Germany
|
82
|
|
QLocale::Ghana
|
83
|
|
QLocale::Gibraltar
|
84
|
|
QLocale::Greece
|
85
|
|
QLocale::Greenland
|
86
|
|
QLocale::Grenada
|
87
|
|
QLocale::Guadeloupe
|
88
|
|
QLocale::Guam
|
89
|
|
QLocale::Guatemala
|
90
|
|
QLocale::Guernsey
|
75
|
|
QLocale::Guinea
|
91
|
|
QLocale::GuineaBissau
|
92
|
|
QLocale::Guyana
|
93
|
|
QLocale::Haiti
|
94
|
|
QLocale::HeardAndMcDonaldIslands
|
95
|
|
QLocale::Honduras
|
96
|
|
QLocale::HongKong
|
97
|
|
QLocale::Hungary
|
98
|
|
QLocale::Iceland
|
99
|
|
QLocale::India
|
100
|
|
QLocale::Indonesia
|
101
|
|
QLocale::Iran
|
102
|
|
QLocale::Iraq
|
103
|
|
QLocale::Ireland
|
104
|
|
QLocale::IsleOfMan
|
251
|
|
QLocale::Israel
|
105
|
|
QLocale::Italy
|
106
|
|
QLocale::IvoryCoast
|
53
|
|
QLocale::Jamaica
|
107
|
|
QLocale::Japan
|
108
|
|
QLocale::Jersey
|
252
|
|
QLocale::Jordan
|
109
|
|
QLocale::Kazakhstan
|
110
|
|
QLocale::Kenya
|
111
|
|
QLocale::Kiribati
|
112
|
|
QLocale::Kosovo
|
257
|
Since Qt 5.2 |
QLocale::Kuwait
|
115
|
|
QLocale::Kyrgyzstan
|
116
|
|
QLocale::Laos
|
117
|
|
QLocale::LatinAmerica
|
246
|
|
QLocale::LatinAmericaAndTheCaribbean
|
LatinAmerica
|
Obsolete, please use LatinAmerica |
QLocale::Latvia
|
118
|
|
QLocale::Lebanon
|
119
|
|
QLocale::Lesotho
|
120
|
|
QLocale::Liberia
|
121
|
|
QLocale::Libya
|
122
|
|
QLocale::Liechtenstein
|
123
|
|
QLocale::Lithuania
|
124
|
|
QLocale::Luxembourg
|
125
|
|
QLocale::Macau
|
126
|
|
QLocale::Macedonia
|
127
|
|
QLocale::Madagascar
|
128
|
|
QLocale::Malawi
|
129
|
|
QLocale::Malaysia
|
130
|
|
QLocale::Maldives
|
131
|
|
QLocale::Mali
|
132
|
|
QLocale::Malta
|
133
|
|
QLocale::MarshallIslands
|
134
|
|
QLocale::Martinique
|
135
|
|
QLocale::Mauritania
|
136
|
|
QLocale::Mauritius
|
137
|
|
QLocale::Mayotte
|
138
|
|
QLocale::Mexico
|
139
|
|
QLocale::Micronesia
|
140
|
|
QLocale::Moldova
|
141
|
|
QLocale::Monaco
|
142
|
|
QLocale::Mongolia
|
143
|
|
QLocale::Montenegro
|
242
|
|
QLocale::Montserrat
|
144
|
|
QLocale::Morocco
|
145
|
|
QLocale::Mozambique
|
146
|
|
QLocale::Myanmar
|
147
|
|
QLocale::Namibia
|
148
|
|
QLocale::NauruCountry
|
149
|
|
QLocale::Nepal
|
150
|
|
QLocale::Netherlands
|
151
|
|
QLocale::NewCaledonia
|
153
|
|
QLocale::NewZealand
|
154
|
|
QLocale::Nicaragua
|
155
|
|
QLocale::Niger
|
156
|
|
QLocale::Nigeria
|
157
|
|
QLocale::Niue
|
158
|
|
QLocale::NorfolkIsland
|
159
|
|
QLocale::NorthernMarianaIslands
|
160
|
|
QLocale::NorthKorea
|
113
|
|
QLocale::Norway
|
161
|
|
QLocale::Oman
|
162
|
|
QLocale::OutlyingOceania
|
259
|
Since Qt 5.7 |
QLocale::Pakistan
|
163
|
|
QLocale::Palau
|
164
|
|
QLocale::PalestinianTerritories
|
165
|
|
QLocale::Panama
|
166
|
|
QLocale::PapuaNewGuinea
|
167
|
|
QLocale::Paraguay
|
168
|
|
QLocale::PeoplesRepublicOfCongo
|
CongoBrazzaville
|
Obsolete, please use CongoBrazzaville |
QLocale::Peru
|
169
|
|
QLocale::Philippines
|
170
|
|
QLocale::Pitcairn
|
171
|
|
QLocale::Poland
|
172
|
|
QLocale::Portugal
|
173
|
|
QLocale::PuertoRico
|
174
|
|
QLocale::Qatar
|
175
|
|
QLocale::RepublicOfKorea
|
SouthKorea
|
Obsolete, please use SouthKorea |
QLocale::Reunion
|
176
|
|
QLocale::Romania
|
177
|
|
QLocale::RussianFederation
|
Russia
|
same as Russia |
QLocale::Russia
|
178
|
same as RussianFederation |
QLocale::Rwanda
|
179
|
|
QLocale::SaintBarthelemy
|
244
|
|
QLocale::SaintHelena
|
199
|
|
QLocale::SaintKittsAndNevis
|
180
|
|
QLocale::SaintLucia
|
181
|
|
QLocale::SaintMartin
|
245
|
|
QLocale::SaintPierreAndMiquelon
|
200
|
|
QLocale::SaintVincentAndTheGrenadines
|
182
|
|
QLocale::Samoa
|
183
|
|
QLocale::SanMarino
|
184
|
|
QLocale::SaoTomeAndPrincipe
|
185
|
|
QLocale::SaudiArabia
|
186
|
|
QLocale::Senegal
|
187
|
|
QLocale::Serbia
|
243
|
|
QLocale::Seychelles
|
188
|
|
QLocale::SierraLeone
|
189
|
|
QLocale::Singapore
|
190
|
|
QLocale::SintMaarten
|
256
|
|
QLocale::Slovakia
|
191
|
|
QLocale::Slovenia
|
192
|
|
QLocale::SolomonIslands
|
193
|
|
QLocale::Somalia
|
194
|
|
QLocale::SouthAfrica
|
195
|
|
QLocale::SouthGeorgiaAndTheSouthSandwichIslands
|
196
|
|
QLocale::SouthKorea
|
114
|
|
QLocale::SouthSudan
|
254
|
|
QLocale::Spain
|
197
|
|
QLocale::SriLanka
|
198
|
|
QLocale::Sudan
|
201
|
|
QLocale::Suriname
|
202
|
|
QLocale::SvalbardAndJanMayenIslands
|
203
|
|
QLocale::Swaziland
|
204
|
|
QLocale::Sweden
|
205
|
|
QLocale::Switzerland
|
206
|
|
QLocale::Syria
|
207
|
|
QLocale::SyrianArabRepublic
|
Syria
|
Obsolete, please use Syria |
QLocale::Taiwan
|
208
|
|
QLocale::Tajikistan
|
209
|
|
QLocale::Tanzania
|
210
|
|
QLocale::Thailand
|
211
|
|
QLocale::Togo
|
212
|
|
QLocale::TokelauCountry
|
213
|
|
QLocale::Tokelau
|
TokelauCountry
|
Obsolete, please use TokelauCountry |
QLocale::Tonga
|
214
|
|
QLocale::TrinidadAndTobago
|
215
|
|
QLocale::TristanDaCunha
|
253
|
|
QLocale::Tunisia
|
216
|
|
QLocale::Turkey
|
217
|
|
QLocale::Turkmenistan
|
218
|
|
QLocale::TurksAndCaicosIslands
|
219
|
|
QLocale::TuvaluCountry
|
220
|
|
QLocale::Tuvalu
|
TuvaluCountry
|
Obsolete, please use TuvaluCountry |
QLocale::Uganda
|
221
|
|
QLocale::Ukraine
|
222
|
|
QLocale::UnitedArabEmirates
|
223
|
|
QLocale::UnitedKingdom
|
224
|
|
QLocale::UnitedStates
|
225
|
|
QLocale::UnitedStatesMinorOutlyingIslands
|
226
|
|
QLocale::UnitedStatesVirginIslands
|
234
|
|
QLocale::Uruguay
|
227
|
|
QLocale::Uzbekistan
|
228
|
|
QLocale::Vanuatu
|
229
|
|
QLocale::VaticanCityState
|
230
|
|
QLocale::Venezuela
|
231
|
|
QLocale::Vietnam
|
232
|
|
QLocale::WallisAndFutunaIslands
|
235
|
|
QLocale::WesternSahara
|
236
|
|
QLocale::World
|
260
|
Since Qt 5.12 |
QLocale::Yemen
|
237
|
|
QLocale::Zambia
|
239
|
|
QLocale::Zimbabwe
|
240
|
另请参阅 country () 和 countryToString ().
指定货币符号的格式。
常量 | 值 | 描述 |
---|---|---|
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. |
该枚举在 Qt 4.8 引入或被修改。
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, ... |
该枚举在 Qt 5.10 引入或被修改。
The DataSizeFormats type is a typedef for QFlags <DataSizeFormat>. It stores an OR combination of DataSizeFormat values.
另请参阅 formattedDataSize ().
This enum defines constants 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. |
该枚举在 Qt 5.7 引入或被修改。
另请参阅 toString (), QString ,和 QByteArray .
此枚举描述可以使用的不同格式,当转换 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
|
4
|
|
QLocale::Afrikaans
|
5
|
|
QLocale::Aghem
|
237
|
|
QLocale::Ahom
|
340
|
Obsolete, no locale data available |
QLocale::Akan
|
146
|
|
QLocale::Akkadian
|
262
|
Since Qt 5.1 |
QLocale::Akoose
|
312
|
Since Qt 5.3 |
QLocale::Albanian
|
6
|
|
QLocale::AmericanSignLanguage
|
341
|
Since Qt 5.7 |
QLocale::Amharic
|
7
|
|
QLocale::AncientEgyptian
|
263
|
Since Qt 5.1 |
QLocale::AncientGreek
|
264
|
Since Qt 5.1 |
QLocale::AncientNorthArabian
|
331
|
Obsolete, no locale data available |
QLocale::Arabic
|
8
|
|
QLocale::Aragonese
|
261
|
Since Qt 5.1 |
QLocale::Aramaic
|
265
|
Since Qt 5.1 |
QLocale::ArdhamagadhiPrakrit
|
342
|
Obsolete, no locale data available |
QLocale::Armenian
|
9
|
|
QLocale::Assamese
|
10
|
|
QLocale::Asturian
|
256
|
|
QLocale::Asu
|
205
|
|
QLocale::Atsam
|
156
|
|
QLocale::Avaric
|
216
|
|
QLocale::Avestan
|
255
|
|
QLocale::Aymara
|
11
|
|
QLocale::Azerbaijani
|
12
|
|
QLocale::Bafia
|
243
|
|
QLocale::Balinese
|
266
|
Since Qt 5.1 |
QLocale::Bambara
|
188
|
|
QLocale::Bamun
|
267
|
Since Qt 5.1 |
QLocale::Basaa
|
238
|
|
QLocale::Bashkir
|
13
|
|
QLocale::Basque
|
14
|
|
QLocale::Bassa
|
336
|
Obsolete, no locale data available |
QLocale::BatakToba
|
268
|
Since Qt 5.1 |
QLocale::Belarusian
|
22
|
|
QLocale::Bemba
|
195
|
|
QLocale::Bena
|
186
|
|
QLocale::Bengali
|
15
|
|
QLocale::Bhojpuri
|
343
|
Since Qt 5.7 |
QLocale::Bhutani
|
Dzongkha
|
过时,请使用 Dzongkha |
QLocale::Bihari
|
17
|
Obsolete, no locale data available |
QLocale::Bislama
|
18
|
|
QLocale::Blin
|
152
|
|
QLocale::Bodo
|
215
|
|
QLocale::Bosnian
|
142
|
|
QLocale::Breton
|
19
|
|
QLocale::Buginese
|
269
|
Since Qt 5.1 |
QLocale::Buhid
|
270
|
Obsolete, no locale data available |
QLocale::Bulgarian
|
20
|
|
QLocale::Burmese
|
21
|
|
QLocale::Byelorussian
|
Belarusian
|
过时,请使用 Belarusian |
QLocale::Cambodian
|
Khmer
|
过时,请使用 Khmer |
QLocale::Cantonese
|
357
|
Since Qt 5.7 |
QLocale::Carian
|
271
|
Obsolete, no locale data available |
QLocale::Catalan
|
24
|
|
QLocale::Cebuano
|
365
|
Since Qt 5.14 |
QLocale::CentralKurdish
|
316
|
Since Qt 5.5 |
QLocale::CentralMoroccoTamazight
|
212
|
|
QLocale::Chakma
|
272
|
Since Qt 5.1 |
QLocale::Chamorro
|
217
|
|
QLocale::Chechen
|
218
|
|
QLocale::Cherokee
|
190
|
|
QLocale::Chewa
|
Nyanja
|
过时,请使用 Nyanja |
QLocale::Chickasaw
|
367
|
Since Qt 5.14 |
QLocale::Chiga
|
211
|
|
QLocale::Chinese
|
25
|
(普通话) |
QLocale::Church
|
219
|
|
QLocale::Chuvash
|
220
|
|
QLocale::ClassicalMandaic
|
273
|
Obsolete, no locale data available |
QLocale::Colognian
|
201
|
|
QLocale::CongoSwahili
|
250
|
Obsolete, no locale data available |
QLocale::Coptic
|
274
|
Since Qt 5.1 |
QLocale::Cornish
|
145
|
|
QLocale::Corsican
|
26
|
|
QLocale::Cree
|
221
|
|
QLocale::Croatian
|
27
|
|
QLocale::Czech
|
28
|
|
QLocale::Danish
|
29
|
|
QLocale::Divehi
|
143
|
|
QLocale::Dogri
|
275
|
Since Qt 5.1 |
QLocale::Duala
|
240
|
|
QLocale::Dutch
|
30
|
|
QLocale::Dzongkha
|
16
|
|
QLocale::EasternCham
|
276
|
Obsolete, no locale data available |
QLocale::EasternKayah
|
277
|
Obsolete, no locale data available |
QLocale::Embu
|
189
|
|
QLocale::English
|
31
|
|
QLocale::Erzya
|
366
|
Since Qt 5.14 |
QLocale::Esperanto
|
32
|
|
QLocale::Estonian
|
33
|
|
QLocale::Etruscan
|
278
|
Obsolete, no locale data available |
QLocale::Ewe
|
161
|
|
QLocale::Ewondo
|
242
|
|
QLocale::Faroese
|
34
|
|
QLocale::Fijian
|
35
|
|
QLocale::Filipino
|
166
|
|
QLocale::Finnish
|
36
|
|
QLocale::French
|
37
|
|
QLocale::Frisian
|
WesternFrisian
|
如同 WesternFrisian |
QLocale::Friulian
|
159
|
|
QLocale::Fulah
|
177
|
|
QLocale::Ga
|
148
|
|
QLocale::Gaelic
|
39
|
|
QLocale::Galician
|
40
|
|
QLocale::Ganda
|
194
|
|
QLocale::Geez
|
153
|
|
QLocale::Georgian
|
41
|
|
QLocale::German
|
42
|
|
QLocale::Gothic
|
279
|
Since Qt 5.1 |
QLocale::Greek
|
43
|
|
QLocale::Greenlandic
|
44
|
|
QLocale::Guarani
|
45
|
|
QLocale::Gujarati
|
46
|
|
QLocale::Gusii
|
175
|
|
QLocale::Haitian
|
222
|
|
QLocale::Hanunoo
|
280
|
Obsolete, no locale data available |
QLocale::Hausa
|
47
|
|
QLocale::Hawaiian
|
163
|
|
QLocale::Hebrew
|
48
|
|
QLocale::Herero
|
223
|
|
QLocale::HieroglyphicLuwian
|
344
|
Obsolete, no locale data available |
QLocale::Hindi
|
49
|
|
QLocale::HiriMotu
|
224
|
|
QLocale::HmongNjua
|
333
|
Obsolete, no locale data available |
QLocale::Ho
|
334
|
Obsolete, no locale data available |
QLocale::Hungarian
|
50
|
|
QLocale::Icelandic
|
51
|
|
QLocale::Ido
|
360
|
Since Qt 5.12 |
QLocale::Igbo
|
149
|
|
QLocale::InariSami
|
326
|
Since Qt 5.5 |
QLocale::Indonesian
|
52
|
|
QLocale::Ingush
|
281
|
Since Qt 5.1 |
QLocale::Interlingua
|
53
|
|
QLocale::Interlingue
|
54
|
|
QLocale::Inuktitut
|
55
|
|
QLocale::Inupiak
|
56
|
|
QLocale::Irish
|
57
|
|
QLocale::Italian
|
58
|
|
QLocale::Japanese
|
59
|
|
QLocale::Javanese
|
60
|
|
QLocale::Jju
|
158
|
|
QLocale::JolaFonyi
|
241
|
|
QLocale::Kabuverdianu
|
196
|
|
QLocale::Kabyle
|
184
|
|
QLocale::Kako
|
258
|
|
QLocale::Kalenjin
|
198
|
|
QLocale::Kamba
|
150
|
|
QLocale::Kannada
|
61
|
|
QLocale::Kanuri
|
225
|
|
QLocale::Kashmiri
|
62
|
|
QLocale::Kazakh
|
63
|
|
QLocale::Kenyang
|
319
|
Since Qt 5.5 |
QLocale::Khmer
|
23
|
|
QLocale::Kiche
|
323
|
Since Qt 5.5 |
QLocale::Kikuyu
|
178
|
|
QLocale::Kinyarwanda
|
64
|
|
QLocale::Kirghiz
|
65
|
|
QLocale::Komi
|
226
|
|
QLocale::Kongo
|
227
|
|
QLocale::Konkani
|
147
|
|
QLocale::Korean
|
66
|
|
QLocale::Koro
|
154
|
|
QLocale::KoyraboroSenni
|
213
|
|
QLocale::KoyraChiini
|
208
|
|
QLocale::Kpelle
|
169
|
|
QLocale::Kurdish
|
67
|
|
QLocale::Kurundi
|
Rundi
|
过时,请使用 Rundi |
QLocale::Kwanyama
|
228
|
|
QLocale::Kwasio
|
246
|
|
QLocale::Lakota
|
313
|
Since Qt 5.3 |
QLocale::Langi
|
193
|
|
QLocale::Lao
|
69
|
|
QLocale::LargeFloweryMiao
|
282
|
Obsolete, no locale data available |
QLocale::Latin
|
70
|
|
QLocale::Latvian
|
71
|
|
QLocale::Lepcha
|
283
|
Obsolete, no locale data available |
QLocale::Lezghian
|
335
|
Since Qt 5.5 |
QLocale::Limburgish
|
229
|
|
QLocale::Limbu
|
284
|
Obsolete, no locale data available |
QLocale::LinearA
|
332
|
Obsolete, no locale data available |
QLocale::Lingala
|
72
|
|
QLocale::Lisu
|
285
|
Obsolete, no locale data available |
QLocale::LiteraryChinese
|
345
|
Since Qt 5.7 |
QLocale::Lithuanian
|
73
|
|
QLocale::Lojban
|
361
|
Since Qt 5.12 |
QLocale::LowerSorbian
|
317
|
Since Qt 5.5 |
QLocale::LowGerman
|
170
|
|
QLocale::LubaKatanga
|
230
|
|
QLocale::LuleSami
|
325
|
Since Qt 5.5 |
QLocale::Luo
|
210
|
|
QLocale::Lu
|
286
|
Obsolete, no locale data available |
QLocale::Luxembourgish
|
231
|
|
QLocale::Luyia
|
204
|
|
QLocale::Lycian
|
287
|
Obsolete, no locale data available |
QLocale::Lydian
|
288
|
Obsolete, no locale data available |
QLocale::Macedonian
|
74
|
|
QLocale::Machame
|
200
|
|
QLocale::Maithili
|
339
|
Since Qt 5.5 |
QLocale::MakhuwaMeetto
|
244
|
|
QLocale::Makonde
|
192
|
|
QLocale::Malagasy
|
75
|
|
QLocale::Malay
|
76
|
|
QLocale::Malayalam
|
77
|
|
QLocale::Maltese
|
78
|
|
QLocale::Mandingo
|
289
|
Since Qt 5.1 |
QLocale::ManichaeanMiddlePersian
|
329
|
Obsolete, no locale data available |
QLocale::Manipuri
|
290
|
Since Qt 5.1 |
QLocale::Manx
|
144
|
|
QLocale::Maori
|
79
|
|
QLocale::Mapuche
|
315
|
Since Qt 5.5 |
QLocale::Marathi
|
80
|
|
QLocale::Marshallese
|
81
|
|
QLocale::Masai
|
202
|
|
QLocale::Mazanderani
|
346
|
Since Qt 5.7 |
QLocale::Mende
|
330
|
Since Qt 5.5 |
QLocale::Meroitic
|
291
|
Obsolete, no locale data available |
QLocale::Meru
|
197
|
|
QLocale::Meta
|
259
|
|
QLocale::Mohawk
|
320
|
Since Qt 5.5 |
QLocale::Moldavian
|
罗马尼亚语
|
Obsolete, please use Romanian |
QLocale::Mongolian
|
82
|
|
QLocale::Mono
|
337
|
Obsolete, no locale data available |
QLocale::Morisyen
|
191
|
|
QLocale::Mru
|
347
|
Obsolete, no locale data available |
QLocale::Mundang
|
245
|
|
QLocale::Muscogee
|
368
|
Since Qt 5.14 |
QLocale::Nama
|
199
|
|
QLocale::NauruLanguage
|
83
|
|
QLocale::Navaho
|
232
|
|
QLocale::Ndonga
|
233
|
|
QLocale::Nepali
|
84
|
|
QLocale::Newari
|
348
|
Since Qt 5.7 |
QLocale::Ngiemboon
|
260
|
|
QLocale::Ngomba
|
257
|
|
QLocale::Nko
|
321
|
Since Qt 5.5 |
QLocale::NorthernLuri
|
349
|
Since Qt 5.7 |
QLocale::NorthernSami
|
173
|
|
QLocale::NorthernSotho
|
172
|
|
QLocale::NorthernThai
|
292
|
Obsolete, no locale data available |
QLocale::NorthNdebele
|
181
|
|
QLocale::NorwegianBokmal
|
85
|
|
QLocale::NorwegianNynorsk
|
141
|
|
QLocale::Norwegian
|
NorwegianBokmal
|
Obsolete, please use NorwegianBokmal |
QLocale::Nuer
|
247
|
|
QLocale::Nyanja
|
165
|
|
QLocale::Nyankole
|
185
|
|
QLocale::Occitan
|
86
|
|
QLocale::Ojibwa
|
234
|
|
QLocale::OldIrish
|
293
|
Since Qt 5.1 |
QLocale::OldNorse
|
294
|
Since Qt 5.1 |
QLocale::OldPersian
|
295
|
Since Qt 5.1 |
QLocale::OldTurkish
|
296
|
Obsolete, no locale data available |
QLocale::Oriya
|
87
|
|
QLocale::Oromo
|
3
|
|
QLocale::Osage
|
358
|
Since Qt 5.7 |
QLocale::Ossetic
|
101
|
|
QLocale::Pahlavi
|
297
|
Since Qt 5.1 |
QLocale::Palauan
|
350
|
Since Qt 5.7 |
QLocale::Pali
|
235
|
|
QLocale::Papiamento
|
351
|
Since Qt 5.7 |
QLocale::Parthian
|
298
|
Obsolete, no locale data available |
QLocale::Pashto
|
88
|
|
QLocale::Persian
|
89
|
|
QLocale::Phoenician
|
299
|
Since Qt 5.1 |
QLocale::Polish
|
90
|
|
QLocale::Portuguese
|
91
|
|
QLocale::PrakritLanguage
|
300
|
Obsolete, no locale data available |
QLocale::Prussian
|
322
|
Since Qt 5.5 |
QLocale::Punjabi
|
92
|
|
QLocale::Quechua
|
93
|
|
QLocale::Rejang
|
301
|
Obsolete, no locale data available |
QLocale::RhaetoRomance
|
Romansh
|
过时,请使用 Romansh |
QLocale::Romanian
|
95
|
|
QLocale::Romansh
|
94
|
|
QLocale::Rombo
|
182
|
|
QLocale::Rundi
|
68
|
|
QLocale::Russian
|
96
|
|
QLocale::Rwa
|
209
|
|
QLocale::Sabaean
|
302
|
Obsolete, no locale data available |
QLocale::Saho
|
207
|
|
QLocale::Sakha
|
248
|
|
QLocale::Samaritan
|
303
|
Obsolete, no locale data available |
QLocale::Samburu
|
179
|
|
QLocale::Samoan
|
97
|
|
QLocale::Sango
|
98
|
|
QLocale::Sangu
|
249
|
|
QLocale::Sanskrit
|
99
|
|
QLocale::Santali
|
304
|
Since Qt 5.1 |
QLocale::Saraiki
|
352
|
Obsolete, no locale data available |
QLocale::Sardinian
|
115
|
|
QLocale::Saurashtra
|
305
|
Since Qt 5.1 |
QLocale::Sena
|
180
|
|
QLocale::Serbian
|
100
|
|
QLocale::SerboCroatian
|
塞尔维亚语
|
Obsolete, please use Serbian |
QLocale::Shambala
|
214
|
|
QLocale::Shona
|
104
|
|
QLocale::SichuanYi
|
168
|
|
QLocale::Sicilian
|
362
|
Since Qt 5.12 |
QLocale::Sidamo
|
155
|
|
QLocale::Silesian
|
369
|
Since Qt 5.14 |
QLocale::Sindhi
|
105
|
|
QLocale::Sinhala
|
106
|
|
QLocale::SkoltSami
|
327
|
Since Qt 5.5 |
QLocale::Slovak
|
108
|
|
QLocale::Slovenian
|
109
|
|
QLocale::Soga
|
203
|
|
QLocale::Somali
|
110
|
|
QLocale::Sora
|
306
|
Obsolete, no locale data available |
QLocale::SouthernKurdish
|
363
|
Since Qt 5.12 |
QLocale::SouthernSami
|
324
|
Since Qt 5.5 |
QLocale::SouthernSotho
|
102
|
|
QLocale::SouthNdebele
|
171
|
|
QLocale::Spanish
|
111
|
|
QLocale::StandardMoroccanTamazight
|
314
|
Since Qt 5.3 |
QLocale::Sundanese
|
112
|
|
QLocale::Swahili
|
113
|
|
QLocale::Swati
|
107
|
|
QLocale::Swedish
|
114
|
|
QLocale::SwissGerman
|
167
|
|
QLocale::Sylheti
|
307
|
Obsolete, no locale data available |
QLocale::Syriac
|
151
|
|
QLocale::Tachelhit
|
183
|
|
QLocale::Tagalog
|
Filipino
|
Obsolete, please use Filipino |
QLocale::Tagbanwa
|
308
|
Obsolete, no locale data available |
QLocale::Tahitian
|
127
|
|
QLocale::TaiDam
|
309
|
Since Qt 5.1 |
QLocale::TaiNua
|
310
|
Obsolete, no locale data available |
QLocale::Taita
|
176
|
|
QLocale::Tajik
|
116
|
|
QLocale::Tamil
|
117
|
|
QLocale::Tangut
|
359
|
Obsolete, no locale data available |
QLocale::Taroko
|
174
|
|
QLocale::Tasawaq
|
251
|
|
QLocale::Tatar
|
118
|
|
QLocale::TedimChin
|
338
|
Obsolete, no locale data available |
QLocale::Telugu
|
119
|
|
QLocale::Teso
|
206
|
|
QLocale::Thai
|
120
|
|
QLocale::Tibetan
|
121
|
|
QLocale::Tigre
|
157
|
|
QLocale::Tigrinya
|
122
|
|
QLocale::TokelauLanguage
|
353
|
Since Qt 5.7 |
QLocale::TokPisin
|
354
|
Since Qt 5.7 |
QLocale::Tongan
|
123
|
|
QLocale::Tsonga
|
124
|
|
QLocale::Tswana
|
103
|
|
QLocale::Turkish
|
125
|
|
QLocale::Turkmen
|
126
|
|
QLocale::TuvaluLanguage
|
355
|
Since Qt 5.7 |
QLocale::Twi
|
Akan
|
Obsolete, please use Akan |
QLocale::Tyap
|
164
|
|
QLocale::Ugaritic
|
311
|
Since Qt 5.1 |
QLocale::Uighur
|
128
|
|
QLocale::Uigur
|
Uighur
|
Obsolete, please use Uighur |
QLocale::Ukrainian
|
129
|
|
QLocale::UncodedLanguages
|
356
|
Obsolete, no locale data available |
QLocale::UpperSorbian
|
318
|
Since Qt 5.5 |
QLocale::Urdu
|
130
|
|
QLocale::Uzbek
|
131
|
|
QLocale::Vai
|
252
|
|
QLocale::Venda
|
160
|
|
QLocale::Vietnamese
|
132
|
|
QLocale::Volapuk
|
133
|
|
QLocale::Vunjo
|
187
|
|
QLocale::Walamo
|
162
|
|
QLocale::Walloon
|
236
|
|
QLocale::Walser
|
253
|
|
QLocale::Warlpiri
|
328
|
Since Qt 5.5 |
QLocale::Welsh
|
134
|
|
QLocale::WesternBalochi
|
364
|
Since Qt 5.12 |
QLocale::WesternFrisian
|
38
|
如同 Frisian |
QLocale::Wolof
|
135
|
|
QLocale::Xhosa
|
136
|
|
QLocale::Yangben
|
254
|
|
QLocale::Yiddish
|
137
|
|
QLocale::Yoruba
|
138
|
|
QLocale::Zarma
|
239
|
|
QLocale::Zhuang
|
139
|
|
QLocale::Zulu
|
140
|
另请参阅 语言 () 和 languageToString ().
此枚举定义用于度量的单位。
常量 | 值 | 描述 |
---|---|---|
QLocale::MetricSystem
|
0
|
This value indicates metric units, such as meters, centimeters and millimeters. |
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 |
该枚举在 Qt 4.4 引入或被修改。
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, with group separators, with one leading zero in single digit exponents, and without trailing zeroes after the decimal dot. |
QLocale::OmitGroupSeparator
|
0x01
|
If this option is set, the number-to-string functions will not insert group separators in their return values. The default is to insert 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, even if the number of significant digits is lower than the requested precision. The default is to omit trailing zeroes. |
QLocale::RejectTrailingZeroesAfterDot
|
0x20
|
If this option is set, the string-to-number functions will fail if they encounter trailing zeroes after the decimal dot 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 ().
此枚举为区域设置特定引号,定义一组可能的样式。
常量 | 值 | 描述 |
---|---|---|
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. |
该枚举在 Qt 4.8 引入或被修改。
另请参阅 quoteString ().
此枚举类型用于指定脚本。
常量 | 值 | 描述 |
---|---|---|
QLocale::AnyScript
|
0
|
|
QLocale::AdlamScript
|
134
|
Since Qt 5.7 |
QLocale::AhomScript
|
128
|
Since Qt 5.7 |
QLocale::AnatolianHieroglyphsScript
|
129
|
Since Qt 5.7 |
QLocale::ArabicScript
|
1
|
|
QLocale::ArmenianScript
|
10
|
|
QLocale::AvestanScript
|
36
|
Since Qt 5.1 |
QLocale::BalineseScript
|
37
|
Since Qt 5.1 |
QLocale::BamumScript
|
38
|
Since Qt 5.1 |
QLocale::BassaVahScript
|
106
|
Since Qt 5.5 |
QLocale::BatakScript
|
39
|
Since Qt 5.1 |
QLocale::BengaliScript
|
11
|
|
QLocale::BhaiksukiScript
|
135
|
Since Qt 5.7 |
QLocale::BopomofoScript
|
40
|
Since Qt 5.1 |
QLocale::BrahmiScript
|
41
|
Since Qt 5.1 |
QLocale::BrailleScript
|
103
|
Since Qt 5.1 |
QLocale::BugineseScript
|
42
|
Since Qt 5.1 |
QLocale::BuhidScript
|
43
|
Since Qt 5.1 |
QLocale::CanadianAboriginalScript
|
44
|
Since Qt 5.1 |
QLocale::CarianScript
|
45
|
Since Qt 5.1 |
QLocale::CaucasianAlbanianScript
|
105
|
Since Qt 5.5 |
QLocale::ChakmaScript
|
46
|
Since Qt 5.1 |
QLocale::ChamScript
|
47
|
Since Qt 5.1 |
QLocale::CherokeeScript
|
12
|
|
QLocale::CopticScript
|
48
|
Since Qt 5.1 |
QLocale::CuneiformScript
|
94
|
Since Qt 5.1 |
QLocale::CypriotScript
|
49
|
Since Qt 5.1 |
QLocale::CyrillicScript
|
2
|
|
QLocale::DeseretScript
|
3
|
Since Qt 5.1 |
QLocale::DevanagariScript
|
13
|
|
QLocale::DuployanScript
|
107
|
Since Qt 5.5 |
QLocale::EgyptianHieroglyphsScript
|
50
|
Since Qt 5.1 |
QLocale::ElbasanScript
|
108
|
Since Qt 5.5 |
QLocale::EthiopicScript
|
14
|
|
QLocale::FraserScript
|
51
|
Since Qt 5.1 |
QLocale::GeorgianScript
|
15
|
|
QLocale::GlagoliticScript
|
52
|
Since Qt 5.1 |
QLocale::GothicScript
|
53
|
Since Qt 5.1 |
QLocale::GranthaScript
|
109
|
Since Qt 5.5 |
QLocale::GreekScript
|
16
|
|
QLocale::GujaratiScript
|
17
|
|
QLocale::GurmukhiScript
|
4
|
|
QLocale::HangulScript
|
55
|
Since Qt 5.1 |
QLocale::HanScript
|
54
|
Since Qt 5.1 |
QLocale::HanunooScript
|
56
|
Since Qt 5.1 |
QLocale::HanWithBopomofoScript
|
140
|
Since Qt 5.7 |
QLocale::HatranScript
|
130
|
Since Qt 5.7 |
QLocale::HebrewScript
|
18
|
|
QLocale::HiraganaScript
|
104
|
Since Qt 5.1 |
QLocale::ImperialAramaicScript
|
57
|
Since Qt 5.1 |
QLocale::InscriptionalPahlaviScript
|
58
|
Since Qt 5.1 |
QLocale::InscriptionalParthianScript
|
59
|
Since Qt 5.1 |
QLocale::JamoScript
|
141
|
Since Qt 5.7 |
QLocale::JapaneseScript
|
19
|
|
QLocale::JavaneseScript
|
60
|
Since Qt 5.1 |
QLocale::KaithiScript
|
61
|
Since Qt 5.1 |
QLocale::KannadaScript
|
21
|
|
QLocale::KatakanaScript
|
62
|
Since Qt 5.1 |
QLocale::KayahLiScript
|
63
|
Since Qt 5.1 |
QLocale::KharoshthiScript
|
64
|
Since Qt 5.1 |
QLocale::KhmerScript
|
20
|
Since Qt 5.1 |
QLocale::KhojkiScript
|
111
|
Since Qt 5.5 |
QLocale::KhudawadiScript
|
125
|
Since Qt 5.5 |
QLocale::KoreanScript
|
22
|
|
QLocale::LannaScript
|
65
|
Since Qt 5.1 |
QLocale::LaoScript
|
23
|
|
QLocale::LatinScript
|
7
|
|
QLocale::LepchaScript
|
66
|
Since Qt 5.1 |
QLocale::LimbuScript
|
67
|
Since Qt 5.1 |
QLocale::LinearAScript
|
112
|
Since Qt 5.5 |
QLocale::LinearBScript
|
68
|
Since Qt 5.1 |
QLocale::LycianScript
|
69
|
Since Qt 5.1 |
QLocale::LydianScript
|
70
|
Since Qt 5.1 |
QLocale::MahajaniScript
|
113
|
Since Qt 5.5 |
QLocale::MalayalamScript
|
24
|
|
QLocale::MandaeanScript
|
71
|
Since Qt 5.1 |
QLocale::ManichaeanScript
|
114
|
Since Qt 5.5 |
QLocale::MarchenScript
|
136
|
Since Qt 5.7 |
QLocale::MeiteiMayekScript
|
72
|
Since Qt 5.1 |
QLocale::MendeKikakuiScript
|
115
|
Since Qt 5.5 |
QLocale::MeroiticCursiveScript
|
74
|
Since Qt 5.1 |
QLocale::MeroiticScript
|
73
|
Since Qt 5.1 |
QLocale::ModiScript
|
116
|
Since Qt 5.5 |
QLocale::MongolianScript
|
8
|
|
QLocale::MroScript
|
117
|
Since Qt 5.5 |
QLocale::MultaniScript
|
131
|
Since Qt 5.7 |
QLocale::MyanmarScript
|
25
|
|
QLocale::NabataeanScript
|
119
|
Since Qt 5.5 |
QLocale::NewaScript
|
137
|
Since Qt 5.7 |
QLocale::NewTaiLueScript
|
76
|
Since Qt 5.1 |
QLocale::NkoScript
|
75
|
Since Qt 5.1 |
QLocale::OghamScript
|
77
|
Since Qt 5.1 |
QLocale::OlChikiScript
|
78
|
Since Qt 5.1 |
QLocale::OldHungarianScript
|
132
|
Since Qt 5.7 |
QLocale::OldItalicScript
|
79
|
Since Qt 5.1 |
QLocale::OldNorthArabianScript
|
118
|
Since Qt 5.5 |
QLocale::OldPermicScript
|
122
|
Since Qt 5.5 |
QLocale::OldPersianScript
|
80
|
Since Qt 5.1 |
QLocale::OldSouthArabianScript
|
81
|
Since Qt 5.1 |
QLocale::OriyaScript
|
26
|
|
QLocale::OrkhonScript
|
82
|
Since Qt 5.1 |
QLocale::OsageScript
|
138
|
Since Qt 5.7 |
QLocale::OsmanyaScript
|
83
|
Since Qt 5.1 |
QLocale::PahawhHmongScript
|
110
|
Since Qt 5.5 |
QLocale::PalmyreneScript
|
120
|
Since Qt 5.5 |
QLocale::PauCinHauScript
|
121
|
Since Qt 5.5 |
QLocale::PhagsPaScript
|
84
|
Since Qt 5.1 |
QLocale::PhoenicianScript
|
85
|
Since Qt 5.1 |
QLocale::PollardPhoneticScript
|
86
|
Since Qt 5.1 |
QLocale::PsalterPahlaviScript
|
123
|
Since Qt 5.5 |
QLocale::RejangScript
|
87
|
Since Qt 5.1 |
QLocale::RunicScript
|
88
|
Since Qt 5.1 |
QLocale::SamaritanScript
|
89
|
Since Qt 5.1 |
QLocale::SaurashtraScript
|
90
|
Since Qt 5.1 |
QLocale::SharadaScript
|
91
|
Since Qt 5.1 |
QLocale::ShavianScript
|
92
|
Since Qt 5.1 |
QLocale::SiddhamScript
|
124
|
Since Qt 5.5 |
QLocale::SignWritingScript
|
133
|
Since Qt 5.7 |
QLocale::SimplifiedChineseScript
|
SimplifiedHanScript
|
如同 SimplifiedHanScript |
QLocale::SimplifiedHanScript
|
5
|
如同 SimplifiedChineseScript |
QLocale::SinhalaScript
|
32
|
|
QLocale::SoraSompengScript
|
93
|
Since Qt 5.1 |
QLocale::SundaneseScript
|
95
|
Since Qt 5.1 |
QLocale::SylotiNagriScript
|
96
|
Since Qt 5.1 |
QLocale::SyriacScript
|
33
|
|
QLocale::TagalogScript
|
97
|
Since Qt 5.1 |
QLocale::TagbanwaScript
|
98
|
Since Qt 5.1 |
QLocale::TaiLeScript
|
99
|
Since Qt 5.1 |
QLocale::TaiVietScript
|
100
|
Since Qt 5.1 |
QLocale::TakriScript
|
101
|
Since Qt 5.1 |
QLocale::TamilScript
|
27
|
|
QLocale::TangutScript
|
139
|
Since Qt 5.7 |
QLocale::TeluguScript
|
28
|
|
QLocale::ThaanaScript
|
29
|
|
QLocale::ThaiScript
|
30
|
|
QLocale::TibetanScript
|
31
|
|
QLocale::TifinaghScript
|
9
|
|
QLocale::TirhutaScript
|
126
|
Since Qt 5.5 |
QLocale::TraditionalChineseScript
|
TraditionalHanScript
|
如同 TraditionalHanScript |
QLocale::TraditionalHanScript
|
6
|
如同 TraditionalChineseScript |
QLocale::UgariticScript
|
102
|
Since Qt 5.1 |
QLocale::VaiScript
|
35
|
|
QLocale::VarangKshitiScript
|
127
|
Since Qt 5.5 |
QLocale::YiScript
|
34
|
另请参阅 script (), scriptToString (),和 languageToString ().
此函数重载 toCurrencyString ().
构造 QLocale 对象作为副本为 other .
构造 QLocale 对象采用指定 语言 , script and country .
The language, script and country that are actually used can be queried using 语言 (), script () 和 country ().
该函数在 Qt 4.8 引入。
另请参阅 setDefault (), 语言 (), script (),和 country ().
构造 QLocale 对象采用指定 语言 and country .
AnyCountry
, the language is used with the most appropriate available country (for example, Germany for German),
The language and country that are actually used can be queried using 语言 () 和 country ().
另请参阅 setDefault (), 语言 (),和 country ().
构造 QLocale 对象采用指定 name , which has the format "language[_script][_country][.codeset][@modifier]" or "C", where:
The separator can be either underscore or a minus sign.
If the string violates the locale format, or language is not a valid ISO 639 code, the "C" locale is used instead. If country is not present, or is not a valid ISO 3166 code, the most appropriate country is chosen for the specified language.
The language, script and country codes are converted to their respective
语言
,
Script
and
Country
enums. After this conversion is performed, the constructor behaves exactly like QLocale(Country, Script, Language).
This constructor is much slower than QLocale(Country, Script, Language).
另请参阅 bcp47Name ().
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 ().
另请参阅 setDefault ().
赋值 other 到此 QLocale 对象并返回引用为此 QLocale 对象。
析构函数
Returns the localized name of the "AM" suffix for times specified using the conventions of the 12-hour clock.
该函数在 Qt 4.5 引入。
另请参阅 pmText ().
Returns the dash-separated language, script and country (and possibly other BCP47 fields) of this locale as a string.
不像 uiLanguages () the returned value of the bcp47Name() represents the locale name of the QLocale data but not the language the user-interface should be in.
此函数会试着使区域设置名称符合 BCP47。
该函数在 Qt 4.8 引入。
另请参阅 语言 (), country (), 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 ().
返回用于整理的区域设置。
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 的构造函数。
该函数在 Qt 5.13 引入。
另请参阅 QCollator .
返回此区域设置的国家。
另请参阅 语言 (), script (), countryToString (),和 bcp47Name ().
[static]
QString
QLocale::
countryToString
(
QLocale::Country
country
)
返回 QString 包含名称对于 country .
另请参阅 languageToString (), scriptToString (), country (),和 bcp47Name ().
Returns a string that represents a join of a given list of strings with a separator defined by the locale.
该函数在 Qt 4.8 引入。
返回货币符号根据 format .
该函数在 Qt 4.8 引入。
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
.
该函数在 Qt 4.1 引入。
另请参阅 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
.
该函数在 Qt 4.4 引入。
另请参阅 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
.
该函数在 Qt 4.2 引入。
另请参阅 monthName () 和 standaloneDayName ().
Returns the decimal point character of this locale.
注意: This function shall change to return a QString 而不是 QChar in Qt6. Callers are encouraged to exploit the QString ( QChar ) constructor to convert early in preparation for this.
该函数在 Qt 4.1 引入。
另请参阅 groupSeparator () 和 toString ().
Returns the exponential character of this locale, used to separate exponent from mantissa in some floating-point numeric representations.
注意: This function shall change to return a QString 而不是 QChar in Qt6. Callers are encouraged to exploit the QString ( QChar ) constructor to convert early in preparation for this.
该函数在 Qt 4.1 引入。
另请参阅 toString (double, char, int).
Returns the first day of the week according to the current locale.
该函数在 Qt 4.8 引入。
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.
该函数在 Qt 5.10 引入。
返回此区域设置的组分隔符。
注意: This function shall change to return a QString 而不是 QChar in Qt6. Callers are encouraged to exploit the QString ( QChar ) constructor to convert early in preparation for this.
该函数在 Qt 4.1 引入。
另请参阅 decimalPoint () 和 toString ().
返回此区域设置的语言。
另请参阅 script (), country (), languageToString (),和 bcp47Name ().
[static]
QString
QLocale::
languageToString
(
QLocale::Language
语言
)
返回 QString 包含名称对于 语言 .
另请参阅 countryToString (), scriptToString (),和 bcp47Name ().
[static]
QList
<
QLocale
> QLocale::
matchingLocales
(
QLocale::Language
语言
,
QLocale::Script
script
,
QLocale::Country
country
)
Returns a list of valid locale objects that match the given 语言 , script and country .
Getting a list of all locales: QList < QLocale > allLocales = QLocale::matchingLocales( QLocale::AnyLanguage , QLocale::AnyScript , QLocale::AnyCountry );
Getting a list of locales suitable for Russia: QList < QLocale > locales = QLocale::matchingLocales( QLocale::AnyLanguage , QLocale::AnyScript , QLocale::Russia );
该函数在 Qt 4.8 引入。
返回区域设置的度量系统。
该函数在 Qt 4.4 引入。
返回本地化名称为 month ,按格式指定通过 type .
例如,若区域设置为
en_US
and
month
is 1,
LongFormat
将返回
January
.
ShortFormat
Jan
,和
NarrowFormat
J
.
该函数在 Qt 4.2 引入。
另请参阅 dayName () 和 standaloneMonthName ().
Returns the language and country of this locale as a string of the form "language_country", where language is a lowercase, two-letter ISO 639 language code, and country is an uppercase, two- or three-letter ISO 3166 country code.
Note that even if 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.
另请参阅 QLocale (), 语言 (), script (), country (),和 bcp47Name ().
Returns a native name of the country for the locale. For example "España" for Spanish/Spain locale.
该函数在 Qt 4.8 引入。
另请参阅 nativeLanguageName () 和 countryToString ().
Returns a native name of the language for the locale. For example "Schwiizertüütsch" for Swiss-German locale.
该函数在 Qt 4.8 引入。
另请参阅 nativeCountryName () 和 languageToString ().
Returns the negative sign character of this locale.
注意: This function shall change to return a QString 而不是 QChar in Qt6. Callers are encouraged to exploit the QString ( QChar ) constructor to convert early in preparation for this.
该函数在 Qt 4.1 引入。
另请参阅 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.
该函数在 Qt 4.2 引入。
另请参阅 setNumberOptions (), toString (),和 groupSeparator ().
返回此区域设置的百分比字符。
注意: This function shall change to return a QString 而不是 QChar in Qt6. Callers are encouraged to exploit the QString ( QChar ) constructor to convert early in preparation for this.
该函数在 Qt 4.1 引入。
另请参阅 toString ().
Returns the localized name of the "PM" suffix for times specified using the conventions of the 12-hour clock.
该函数在 Qt 4.5 引入。
另请参阅 amText ().
返回此区域设置的正号字符。
注意: This function shall change to return a QString 而不是 QChar in Qt6. Callers are encouraged to exploit the QString ( QChar ) constructor to convert early in preparation for this.
该函数在 Qt 4.5 引入。
另请参阅 negativeSign () 和 toString ().
返回 str quoted according to the current locale using the given quotation style .
该函数在 Qt 4.8 引入。
这是重载函数。
该函数在 Qt 4.8 引入。
返回此区域设置的脚本。
该函数在 Qt 4.8 引入。
另请参阅 语言 (), country (), languageToString (), scriptToString (),和 bcp47Name ().
[static]
QString
QLocale::
scriptToString
(
QLocale::Script
script
)
返回 QString 包含名称对于 script .
该函数在 Qt 4.8 引入。
另请参阅 languageToString (), countryToString (), script (),和 bcp47Name ().
[static]
void
QLocale::
setDefault
(const
QLocale
&
locale
)
将全局默认区域设置设为 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.
警告: 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 实例。
该函数在 Qt 4.2 引入。
另请参阅 numberOptions ().
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 ().
该函数在 Qt 4.5 引入。
另请参阅 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 ().
该函数在 Qt 4.5 引入。
另请参阅 monthName () 和 standaloneDayName ().
交换区域设置 other 与此区域设置。此操作非常快且从不失败。
该函数在 Qt 5.6 引入。
[static]
QLocale
QLocale::
system
()
返回 QLocale object initialized to the system locale.
On Windows and Mac, this locale will use the decimal/grouping characters and date/time formats specified in the system configuration panel.
另请参阅 c ().
返回语言的文本方向。
该函数在 Qt 4.7 引入。
返回用于当前区域设置的时间格式。
若
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
.
该函数在 Qt 4.1 引入。
另请参阅 QTime::toString () 和 QTime::fromString ().
返回本地化字符串表示为 value 以货币方式。若 symbol is provided it is used instead of the default currency symbol.
该函数在 Qt 4.8 引入。
另请参阅 currencySymbol ().
这是重载函数。
该函数在 Qt 4.8 引入。
这是重载函数。
该函数在 Qt 4.8 引入。
这是重载函数。
该函数在 Qt 4.8 引入。
这是重载函数。
该函数在 Qt 4.8 引入。
这是重载函数。
该函数在 Qt 4.8 引入。
这是重载函数。
该函数在 Qt 4.8 引入。
此函数重载 toCurrencyString()。
返回本地化字符串表示为 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.
该函数在 Qt 5.7 引入。
另请参阅 currencySymbol ().
Parses the date string given in string and returns the date. The format of the date string is chosen according to the format 参数 (见 dateFormat ()).
If the date could not be parsed, returns an invalid date.
该函数在 Qt 4.4 引入。
另请参阅 dateFormat (), toTime (), toDateTime (),和 QDate::fromString ().
Parses the date string given in string and returns the date. See QDate::fromString () for information on the expressions that can be used with this function.
This function searches month names and the names of the days of the week in the current locale.
If the date could not be parsed, returns an invalid date.
该函数在 Qt 4.4 引入。
另请参阅 dateFormat (), toTime (), toDateTime (),和 QDate::fromString ().
这是重载函数。
该函数在 Qt 5.14 引入。
这是重载函数。
该函数在 Qt 5.14 引入。
Parses the date/time string given in string and returns the time. The format of the date/time string is chosen according to the format 参数 (见 dateTimeFormat ()).
If the string could not be parsed, returns an invalid QDateTime .
该函数在 Qt 4.4 引入。
另请参阅 dateTimeFormat (), toTime (), toDate (),和 QDateTime::fromString ().
Parses the date/time string given in string and returns the time. See QDateTime::fromString () for information on the expressions that can be used with this function.
注意: The month and day names used must be given in the user's local language.
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.
该函数在 Qt 4.4 引入。
另请参阅 dateTimeFormat (), toTime (), toDate (),和 QDateTime::fromString ().
这是重载函数。
该函数在 Qt 5.14 引入。
这是重载函数。
该函数在 Qt 5.14 引入。
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
.
This function does not fall back to the 'C' locale if the string cannot be interpreted in this locale.
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 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
.
This function does not fall back to the 'C' locale if the string cannot be interpreted in this locale.
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.
此函数忽略前导和结尾空格。
该函数在 Qt 5.1 引入。
另请参阅 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
.
不像 QString::toDouble (), this function does not fall back to the "C" locale if the string cannot be interpreted in this locale.
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.
此函数忽略前导和结尾空格。
该函数在 Qt 5.10 引入。
另请参阅 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
.
This function does not fall back to the 'C' locale if the string cannot be interpreted in this locale.
此函数忽略前导和结尾空格。
另请参阅 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
.
This function does not fall back to the 'C' locale if the string cannot be interpreted in this locale.
此函数忽略前导和结尾空格。
该函数在 Qt 5.1 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.10 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.1 引入。
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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.10 引入。
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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.13 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.13 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.13 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.1 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.10 引入。
另请参阅 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.
该函数在 Qt 4.8 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.1 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.10 引入。
另请参阅 toUShort () 和 toString ().
返回本地化字符串表示为 i .
另请参阅 toLongLong (), numberOptions (), zeroDigit (),和 positiveSign ().
这是重载函数。
另请参阅 toULongLong (), numberOptions (), zeroDigit (),和 positiveSign ().
这是重载函数。
另请参阅 toLong ().
这是重载函数。
另请参阅 toULong ().
这是重载函数。
另请参阅 toShort ().
这是重载函数。
另请参阅 toUShort ().
这是重载函数。
另请参阅 toInt ().
这是重载函数。
另请参阅 toUInt ().
这是重载函数。
f and prec 拥有相同含义如在 QString::number (double, char, int).
另请参阅 toDouble (), numberOptions (), exponential (), decimalPoint (), zeroDigit (), positiveSign (),和 percent ().
这是重载函数。
f and prec 拥有相同含义如在 QString::number (double, char, int).
另请参阅 toDouble ().
返回本地化字符串表示为给定 date 以指定 format 。若 format 是空字符串,返回空字符串。
另请参阅 QDate::toString ().
返回本地化字符串表示为给定 time 根据指定 format 。若 format 是空字符串,返回空字符串。
另请参阅 QTime::toString ().
返回本地化字符串表示为给定 dateTime 根据指定 format 。若 format 是空字符串,返回空字符串。
该函数在 Qt 4.4 引入。
另请参阅 QDateTime::toString (), QDate::toString (),和 QTime::toString ().
这是重载函数。
该函数在 Qt 5.10 引入。
返回本地化字符串表示为给定 time 根据指定 format 。若 format 是空字符串,返回空字符串。
该函数在 Qt 4.5 引入。
另请参阅 QTime::toString ().
这是重载函数。
该函数在 Qt 5.10 引入。
这是重载函数。
该函数在 Qt 4.5 引入。
返回本地化字符串表示为给定 time 以指定 format (见 timeFormat ()).
这是重载函数。
该函数在 Qt 4.4 引入。
返回本地化字符串表示为给定 date 以指定 format , optionally for a specified calendar cal 。若 format 是空字符串,返回空字符串。
该函数在 Qt 5.14 引入。
另请参阅 QDate::toString ().
返回本地化字符串表示为给定 date 根据指定 format (见 dateFormat ()), optionally for a specified calendar cal .
注意: Some locales may use formats that limit the range of years they can represent.
该函数在 Qt 5.14 引入。
返回本地化字符串表示为给定 dateTime 根据指定 format (见 dateTimeFormat ()), optionally for a specified calendar cal .
注意: Some locales may use formats that limit the range of years they can represent.
该函数在 Qt 5.14 引入。
返回本地化字符串表示为给定 dateTime 根据指定 format , optionally for a specified calendar cal 。若 format 是空字符串,返回空字符串。
该函数在 Qt 5.14 引入。
另请参阅 QDateTime::toString (), QDate::toString (),和 QTime::toString ().
Parses the time string given in string and returns the time. The format of the time string is chosen according to the format 参数 (见 timeFormat ()).
If the time could not be parsed, returns an invalid time.
该函数在 Qt 4.4 引入。
另请参阅 timeFormat (), toDate (), toDateTime (),和 QTime::fromString ().
Parses the time string given in string and returns the time. See QTime::fromString () for information on what is a valid format string.
If the time could not be parsed, returns an invalid time.
该函数在 Qt 4.4 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.1 引入。
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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.10 引入。
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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.13 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.13 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.13 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.1 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.10 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.1 引入。
另请参阅 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
.
此函数忽略前导和结尾空格。
该函数在 Qt 5.10 引入。
另请参阅 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.
该函数在 Qt 4.8 引入。
另请参阅 QString::toUpper ().
Returns an ordered list of locale names for translation purposes in preference order (like "en-Latn-US", "en-US", "en").
The return value represents locale names that the user expects to see the UI translation in.
Most like you do not need to use this function directly, but just pass the QLocale 对象到 QTranslator::load () 函数。
The first item in the list is the most preferred one.
该函数在 Qt 4.8 引入。
另请参阅 QTranslator and bcp47Name ().
Returns a list of days that are considered weekdays according to the current locale.
该函数在 Qt 4.8 引入。
返回此区域设置的 0 数字字符。
注意: This function shall change to return a QString 而不是 QChar in Qt6. Callers are encouraged to exploit the QString ( QChar ) constructor to convert early in preparation for this.
该函数在 Qt 4.1 引入。
另请参阅 toString ().
返回
true
若
QLocale
object is not the same as the
other
locale specified; otherwise returns
false
.
返回
true
若
QLocale
object is the same as the
other
locale specified; otherwise returns
false
.
返回哈希值为 key ,使用 seed 做计算种子。
该函数在 Qt 5.6 引入。