QtBase  v6.3.1
Public Types | Public Member Functions | Static Public Member Functions | Friends | Related Functions | List of all members
QLocale Class Reference

#include <qlocale.h>

Public Types

enum  Language : ushort {
  AnyLanguage = 0 , C = 1 , Abkhazian = 2 , Afar = 3 ,
  Afrikaans = 4 , Aghem = 5 , Akan = 6 , Akkadian = 7 ,
  Akoose = 8 , Albanian = 9 , AmericanSignLanguage = 10 , Amharic = 11 ,
  AncientEgyptian = 12 , AncientGreek = 13 , Arabic = 14 , Aragonese = 15 ,
  Aramaic = 16 , Armenian = 17 , Assamese = 18 , Asturian = 19 ,
  Asu = 20 , Atsam = 21 , Avaric = 22 , Avestan = 23 ,
  Aymara = 24 , Azerbaijani = 25 , Bafia = 26 , Balinese = 27 ,
  Bambara = 28 , Bamun = 29 , Bangla = 30 , Basaa = 31 ,
  Bashkir = 32 , Basque = 33 , BatakToba = 34 , Belarusian = 35 ,
  Bemba = 36 , Bena = 37 , Bhojpuri = 38 , Bislama = 39 ,
  Blin = 40 , Bodo = 41 , Bosnian = 42 , Breton = 43 ,
  Buginese = 44 , Bulgarian = 45 , Burmese = 46 , Cantonese = 47 ,
  Catalan = 48 , Cebuano = 49 , CentralAtlasTamazight = 50 , CentralKurdish = 51 ,
  Chakma = 52 , Chamorro = 53 , Chechen = 54 , Cherokee = 55 ,
  Chickasaw = 56 , Chiga = 57 , Chinese = 58 , Church = 59 ,
  Chuvash = 60 , Colognian = 61 , Coptic = 62 , Cornish = 63 ,
  Corsican = 64 , Cree = 65 , Croatian = 66 , Czech = 67 ,
  Danish = 68 , Divehi = 69 , Dogri = 70 , Duala = 71 ,
  Dutch = 72 , Dzongkha = 73 , Embu = 74 , English = 75 ,
  Erzya = 76 , Esperanto = 77 , Estonian = 78 , Ewe = 79 ,
  Ewondo = 80 , Faroese = 81 , Fijian = 82 , Filipino = 83 ,
  Finnish = 84 , French = 85 , Friulian = 86 , Fulah = 87 ,
  Gaelic = 88 , Ga = 89 , Galician = 90 , Ganda = 91 ,
  Geez = 92 , Georgian = 93 , German = 94 , Gothic = 95 ,
  Greek = 96 , Guarani = 97 , Gujarati = 98 , Gusii = 99 ,
  Haitian = 100 , Hausa = 101 , Hawaiian = 102 , Hebrew = 103 ,
  Herero = 104 , Hindi = 105 , HiriMotu = 106 , Hungarian = 107 ,
  Icelandic = 108 , Ido = 109 , Igbo = 110 , InariSami = 111 ,
  Indonesian = 112 , Ingush = 113 , Interlingua = 114 , Interlingue = 115 ,
  Inuktitut = 116 , Inupiaq = 117 , Irish = 118 , Italian = 119 ,
  Japanese = 120 , Javanese = 121 , Jju = 122 , JolaFonyi = 123 ,
  Kabuverdianu = 124 , Kabyle = 125 , Kako = 126 , Kalaallisut = 127 ,
  Kalenjin = 128 , Kamba = 129 , Kannada = 130 , Kanuri = 131 ,
  Kashmiri = 132 , Kazakh = 133 , Kenyang = 134 , Khmer = 135 ,
  Kiche = 136 , Kikuyu = 137 , Kinyarwanda = 138 , Komi = 139 ,
  Kongo = 140 , Konkani = 141 , Korean = 142 , Koro = 143 ,
  KoyraboroSenni = 144 , KoyraChiini = 145 , Kpelle = 146 , Kuanyama = 147 ,
  Kurdish = 148 , Kwasio = 149 , Kyrgyz = 150 , Lakota = 151 ,
  Langi = 152 , Lao = 153 , Latin = 154 , Latvian = 155 ,
  Lezghian = 156 , Limburgish = 157 , Lingala = 158 , LiteraryChinese = 159 ,
  Lithuanian = 160 , Lojban = 161 , LowerSorbian = 162 , LowGerman = 163 ,
  LubaKatanga = 164 , LuleSami = 165 , Luo = 166 , Luxembourgish = 167 ,
  Luyia = 168 , Macedonian = 169 , Machame = 170 , Maithili = 171 ,
  MakhuwaMeetto = 172 , Makonde = 173 , Malagasy = 174 , Malayalam = 175 ,
  Malay = 176 , Maltese = 177 , Mandingo = 178 , Manipuri = 179 ,
  Manx = 180 , Maori = 181 , Mapuche = 182 , Marathi = 183 ,
  Marshallese = 184 , Masai = 185 , Mazanderani = 186 , Mende = 187 ,
  Meru = 188 , Meta = 189 , Mohawk = 190 , Mongolian = 191 ,
  Morisyen = 192 , Mundang = 193 , Muscogee = 194 , Nama = 195 ,
  NauruLanguage = 196 , Navajo = 197 , Ndonga = 198 , Nepali = 199 ,
  Newari = 200 , Ngiemboon = 201 , Ngomba = 202 , NigerianPidgin = 203 ,
  Nko = 204 , NorthernLuri = 205 , NorthernSami = 206 , NorthernSotho = 207 ,
  NorthNdebele = 208 , NorwegianBokmal = 209 , NorwegianNynorsk = 210 , Nuer = 211 ,
  Nyanja = 212 , Nyankole = 213 , Occitan = 214 , Odia = 215 ,
  Ojibwa = 216 , OldIrish = 217 , OldNorse = 218 , OldPersian = 219 ,
  Oromo = 220 , Osage = 221 , Ossetic = 222 , Pahlavi = 223 ,
  Palauan = 224 , Pali = 225 , Papiamento = 226 , Pashto = 227 ,
  Persian = 228 , Phoenician = 229 , Polish = 230 , Portuguese = 231 ,
  Prussian = 232 , Punjabi = 233 , Quechua = 234 , Romanian = 235 ,
  Romansh = 236 , Rombo = 237 , Rundi = 238 , Russian = 239 ,
  Rwa = 240 , Saho = 241 , Sakha = 242 , Samburu = 243 ,
  Samoan = 244 , Sango = 245 , Sangu = 246 , Sanskrit = 247 ,
  Santali = 248 , Sardinian = 249 , Saurashtra = 250 , Sena = 251 ,
  Serbian = 252 , Shambala = 253 , Shona = 254 , SichuanYi = 255 ,
  Sicilian = 256 , Sidamo = 257 , Silesian = 258 , Sindhi = 259 ,
  Sinhala = 260 , SkoltSami = 261 , Slovak = 262 , Slovenian = 263 ,
  Soga = 264 , Somali = 265 , SouthernKurdish = 266 , SouthernSami = 267 ,
  SouthernSotho = 268 , SouthNdebele = 269 , Spanish = 270 , StandardMoroccanTamazight = 271 ,
  Sundanese = 272 , Swahili = 273 , Swati = 274 , Swedish = 275 ,
  SwissGerman = 276 , Syriac = 277 , Tachelhit = 278 , Tahitian = 279 ,
  TaiDam = 280 , Taita = 281 , Tajik = 282 , Tamil = 283 ,
  Taroko = 284 , Tasawaq = 285 , Tatar = 286 , Telugu = 287 ,
  Teso = 288 , Thai = 289 , Tibetan = 290 , Tigre = 291 ,
  Tigrinya = 292 , TokelauLanguage = 293 , TokPisin = 294 , Tongan = 295 ,
  Tsonga = 296 , Tswana = 297 , Turkish = 298 , Turkmen = 299 ,
  TuvaluLanguage = 300 , Tyap = 301 , Ugaritic = 302 , Ukrainian = 303 ,
  UpperSorbian = 304 , Urdu = 305 , Uyghur = 306 , Uzbek = 307 ,
  Vai = 308 , Venda = 309 , Vietnamese = 310 , Volapuk = 311 ,
  Vunjo = 312 , Walloon = 313 , Walser = 314 , Warlpiri = 315 ,
  Welsh = 316 , WesternBalochi = 317 , WesternFrisian = 318 , Wolaytta = 319 ,
  Wolof = 320 , Xhosa = 321 , Yangben = 322 , Yiddish = 323 ,
  Yoruba = 324 , Zarma = 325 , Zhuang = 326 , Zulu = 327 ,
  Kaingang = 328 , Nheengatu = 329 , Afan = Oromo , Bengali = Bangla ,
  Bhutani = Dzongkha , Byelorussian = Belarusian , Cambodian = Khmer , CentralMoroccoTamazight = CentralAtlasTamazight ,
  Chewa = Nyanja , Frisian = WesternFrisian , Greenlandic = Kalaallisut , Inupiak = Inupiaq ,
  Kirghiz = Kyrgyz , Kurundi = Rundi , Kwanyama = Kuanyama , Navaho = Navajo ,
  Oriya = Odia , RhaetoRomance = Romansh , Uighur = Uyghur , Uigur = Uyghur ,
  Walamo = Wolaytta , LastLanguage = Nheengatu
}
 
enum  Script : ushort {
  AnyScript = 0 , AdlamScript = 1 , AhomScript = 2 , AnatolianHieroglyphsScript = 3 ,
  ArabicScript = 4 , ArmenianScript = 5 , AvestanScript = 6 , BalineseScript = 7 ,
  BamumScript = 8 , BanglaScript = 9 , BassaVahScript = 10 , BatakScript = 11 ,
  BhaiksukiScript = 12 , BopomofoScript = 13 , BrahmiScript = 14 , BrailleScript = 15 ,
  BugineseScript = 16 , BuhidScript = 17 , CanadianAboriginalScript = 18 , CarianScript = 19 ,
  CaucasianAlbanianScript = 20 , ChakmaScript = 21 , ChamScript = 22 , CherokeeScript = 23 ,
  CopticScript = 24 , CuneiformScript = 25 , CypriotScript = 26 , CyrillicScript = 27 ,
  DeseretScript = 28 , DevanagariScript = 29 , DuployanScript = 30 , EgyptianHieroglyphsScript = 31 ,
  ElbasanScript = 32 , EthiopicScript = 33 , FraserScript = 34 , GeorgianScript = 35 ,
  GlagoliticScript = 36 , GothicScript = 37 , GranthaScript = 38 , GreekScript = 39 ,
  GujaratiScript = 40 , GurmukhiScript = 41 , HangulScript = 42 , HanScript = 43 ,
  HanunooScript = 44 , HanWithBopomofoScript = 45 , HatranScript = 46 , HebrewScript = 47 ,
  HiraganaScript = 48 , ImperialAramaicScript = 49 , InscriptionalPahlaviScript = 50 , InscriptionalParthianScript = 51 ,
  JamoScript = 52 , JapaneseScript = 53 , JavaneseScript = 54 , KaithiScript = 55 ,
  KannadaScript = 56 , KatakanaScript = 57 , KayahLiScript = 58 , KharoshthiScript = 59 ,
  KhmerScript = 60 , KhojkiScript = 61 , KhudawadiScript = 62 , KoreanScript = 63 ,
  LannaScript = 64 , LaoScript = 65 , LatinScript = 66 , LepchaScript = 67 ,
  LimbuScript = 68 , LinearAScript = 69 , LinearBScript = 70 , LycianScript = 71 ,
  LydianScript = 72 , MahajaniScript = 73 , MalayalamScript = 74 , MandaeanScript = 75 ,
  ManichaeanScript = 76 , MarchenScript = 77 , MeiteiMayekScript = 78 , MendeScript = 79 ,
  MeroiticCursiveScript = 80 , MeroiticScript = 81 , ModiScript = 82 , MongolianScript = 83 ,
  MroScript = 84 , MultaniScript = 85 , MyanmarScript = 86 , NabataeanScript = 87 ,
  NewaScript = 88 , NewTaiLueScript = 89 , NkoScript = 90 , OdiaScript = 91 ,
  OghamScript = 92 , OlChikiScript = 93 , OldHungarianScript = 94 , OldItalicScript = 95 ,
  OldNorthArabianScript = 96 , OldPermicScript = 97 , OldPersianScript = 98 , OldSouthArabianScript = 99 ,
  OrkhonScript = 100 , OsageScript = 101 , OsmanyaScript = 102 , PahawhHmongScript = 103 ,
  PalmyreneScript = 104 , PauCinHauScript = 105 , PhagsPaScript = 106 , PhoenicianScript = 107 ,
  PollardPhoneticScript = 108 , PsalterPahlaviScript = 109 , RejangScript = 110 , RunicScript = 111 ,
  SamaritanScript = 112 , SaurashtraScript = 113 , SharadaScript = 114 , ShavianScript = 115 ,
  SiddhamScript = 116 , SignWritingScript = 117 , SimplifiedHanScript = 118 , SinhalaScript = 119 ,
  SoraSompengScript = 120 , SundaneseScript = 121 , SylotiNagriScript = 122 , SyriacScript = 123 ,
  TagalogScript = 124 , TagbanwaScript = 125 , TaiLeScript = 126 , TaiVietScript = 127 ,
  TakriScript = 128 , TamilScript = 129 , TangutScript = 130 , TeluguScript = 131 ,
  ThaanaScript = 132 , ThaiScript = 133 , TibetanScript = 134 , TifinaghScript = 135 ,
  TirhutaScript = 136 , TraditionalHanScript = 137 , UgariticScript = 138 , VaiScript = 139 ,
  VarangKshitiScript = 140 , YiScript = 141 , BengaliScript = BanglaScript , MendeKikakuiScript = MendeScript ,
  OriyaScript = OdiaScript , SimplifiedChineseScript = SimplifiedHanScript , TraditionalChineseScript = TraditionalHanScript , LastScript = YiScript
}
 
enum  Country : ushort {
  AnyTerritory = 0 , Afghanistan = 1 , AlandIslands = 2 , Albania = 3 ,
  Algeria = 4 , AmericanSamoa = 5 , Andorra = 6 , Angola = 7 ,
  Anguilla = 8 , Antarctica = 9 , AntiguaAndBarbuda = 10 , Argentina = 11 ,
  Armenia = 12 , Aruba = 13 , AscensionIsland = 14 , Australia = 15 ,
  Austria = 16 , Azerbaijan = 17 , Bahamas = 18 , Bahrain = 19 ,
  Bangladesh = 20 , Barbados = 21 , Belarus = 22 , Belgium = 23 ,
  Belize = 24 , Benin = 25 , Bermuda = 26 , Bhutan = 27 ,
  Bolivia = 28 , BosniaAndHerzegovina = 29 , Botswana = 30 , BouvetIsland = 31 ,
  Brazil = 32 , BritishIndianOceanTerritory = 33 , BritishVirginIslands = 34 , Brunei = 35 ,
  Bulgaria = 36 , BurkinaFaso = 37 , Burundi = 38 , Cambodia = 39 ,
  Cameroon = 40 , Canada = 41 , CanaryIslands = 42 , CapeVerde = 43 ,
  CaribbeanNetherlands = 44 , CaymanIslands = 45 , CentralAfricanRepublic = 46 , CeutaAndMelilla = 47 ,
  Chad = 48 , Chile = 49 , China = 50 , ChristmasIsland = 51 ,
  ClippertonIsland = 52 , CocosIslands = 53 , Colombia = 54 , Comoros = 55 ,
  CongoBrazzaville = 56 , CongoKinshasa = 57 , CookIslands = 58 , CostaRica = 59 ,
  Croatia = 60 , Cuba = 61 , Curacao = 62 , Cyprus = 63 ,
  Czechia = 64 , Denmark = 65 , DiegoGarcia = 66 , Djibouti = 67 ,
  Dominica = 68 , DominicanRepublic = 69 , Ecuador = 70 , Egypt = 71 ,
  ElSalvador = 72 , EquatorialGuinea = 73 , Eritrea = 74 , Estonia = 75 ,
  Eswatini = 76 , Ethiopia = 77 , Europe = 78 , EuropeanUnion = 79 ,
  FalklandIslands = 80 , FaroeIslands = 81 , Fiji = 82 , Finland = 83 ,
  France = 84 , FrenchGuiana = 85 , FrenchPolynesia = 86 , FrenchSouthernTerritories = 87 ,
  Gabon = 88 , Gambia = 89 , Georgia = 90 , Germany = 91 ,
  Ghana = 92 , Gibraltar = 93 , Greece = 94 , Greenland = 95 ,
  Grenada = 96 , Guadeloupe = 97 , Guam = 98 , Guatemala = 99 ,
  Guernsey = 100 , GuineaBissau = 101 , Guinea = 102 , Guyana = 103 ,
  Haiti = 104 , HeardAndMcDonaldIslands = 105 , Honduras = 106 , HongKong = 107 ,
  Hungary = 108 , Iceland = 109 , India = 110 , Indonesia = 111 ,
  Iran = 112 , Iraq = 113 , Ireland = 114 , IsleOfMan = 115 ,
  Israel = 116 , Italy = 117 , IvoryCoast = 118 , Jamaica = 119 ,
  Japan = 120 , Jersey = 121 , Jordan = 122 , Kazakhstan = 123 ,
  Kenya = 124 , Kiribati = 125 , Kosovo = 126 , Kuwait = 127 ,
  Kyrgyzstan = 128 , Laos = 129 , LatinAmerica = 130 , Latvia = 131 ,
  Lebanon = 132 , Lesotho = 133 , Liberia = 134 , Libya = 135 ,
  Liechtenstein = 136 , Lithuania = 137 , Luxembourg = 138 , Macao = 139 ,
  Macedonia = 140 , Madagascar = 141 , Malawi = 142 , Malaysia = 143 ,
  Maldives = 144 , Mali = 145 , Malta = 146 , MarshallIslands = 147 ,
  Martinique = 148 , Mauritania = 149 , Mauritius = 150 , Mayotte = 151 ,
  Mexico = 152 , Micronesia = 153 , Moldova = 154 , Monaco = 155 ,
  Mongolia = 156 , Montenegro = 157 , Montserrat = 158 , Morocco = 159 ,
  Mozambique = 160 , Myanmar = 161 , Namibia = 162 , NauruTerritory = 163 ,
  Nepal = 164 , Netherlands = 165 , NewCaledonia = 166 , NewZealand = 167 ,
  Nicaragua = 168 , Nigeria = 169 , Niger = 170 , Niue = 171 ,
  NorfolkIsland = 172 , NorthernMarianaIslands = 173 , NorthKorea = 174 , Norway = 175 ,
  Oman = 176 , OutlyingOceania = 177 , Pakistan = 178 , Palau = 179 ,
  PalestinianTerritories = 180 , Panama = 181 , PapuaNewGuinea = 182 , Paraguay = 183 ,
  Peru = 184 , Philippines = 185 , Pitcairn = 186 , Poland = 187 ,
  Portugal = 188 , PuertoRico = 189 , Qatar = 190 , Reunion = 191 ,
  Romania = 192 , Russia = 193 , Rwanda = 194 , SaintBarthelemy = 195 ,
  SaintHelena = 196 , SaintKittsAndNevis = 197 , SaintLucia = 198 , SaintMartin = 199 ,
  SaintPierreAndMiquelon = 200 , SaintVincentAndGrenadines = 201 , Samoa = 202 , SanMarino = 203 ,
  SaoTomeAndPrincipe = 204 , SaudiArabia = 205 , Senegal = 206 , Serbia = 207 ,
  Seychelles = 208 , SierraLeone = 209 , Singapore = 210 , SintMaarten = 211 ,
  Slovakia = 212 , Slovenia = 213 , SolomonIslands = 214 , Somalia = 215 ,
  SouthAfrica = 216 , SouthGeorgiaAndSouthSandwichIslands = 217 , SouthKorea = 218 , SouthSudan = 219 ,
  Spain = 220 , SriLanka = 221 , Sudan = 222 , Suriname = 223 ,
  SvalbardAndJanMayen = 224 , Sweden = 225 , Switzerland = 226 , Syria = 227 ,
  Taiwan = 228 , Tajikistan = 229 , Tanzania = 230 , Thailand = 231 ,
  TimorLeste = 232 , Togo = 233 , TokelauTerritory = 234 , Tonga = 235 ,
  TrinidadAndTobago = 236 , TristanDaCunha = 237 , Tunisia = 238 , Turkey = 239 ,
  Turkmenistan = 240 , TurksAndCaicosIslands = 241 , TuvaluTerritory = 242 , Uganda = 243 ,
  Ukraine = 244 , UnitedArabEmirates = 245 , UnitedKingdom = 246 , UnitedStatesOutlyingIslands = 247 ,
  UnitedStates = 248 , UnitedStatesVirginIslands = 249 , Uruguay = 250 , Uzbekistan = 251 ,
  Vanuatu = 252 , VaticanCity = 253 , Venezuela = 254 , Vietnam = 255 ,
  WallisAndFutuna = 256 , WesternSahara = 257 , World = 258 , Yemen = 259 ,
  Zambia = 260 , Zimbabwe = 261 , AnyCountry = AnyTerritory , Bonaire = CaribbeanNetherlands ,
  BosniaAndHerzegowina = BosniaAndHerzegovina , CuraSao = Curacao , CzechRepublic = Czechia , DemocraticRepublicOfCongo = CongoKinshasa ,
  DemocraticRepublicOfKorea = NorthKorea , EastTimor = TimorLeste , LatinAmericaAndTheCaribbean = LatinAmerica , Macau = Macao ,
  NauruCountry = NauruTerritory , PeoplesRepublicOfCongo = CongoBrazzaville , RepublicOfKorea = SouthKorea , RussianFederation = Russia ,
  SaintVincentAndTheGrenadines = SaintVincentAndGrenadines , SouthGeorgiaAndTheSouthSandwichIslands = SouthGeorgiaAndSouthSandwichIslands , SvalbardAndJanMayenIslands = SvalbardAndJanMayen , Swaziland = Eswatini ,
  SyrianArabRepublic = Syria , TokelauCountry = TokelauTerritory , TuvaluCountry = TuvaluTerritory , UnitedStatesMinorOutlyingIslands = UnitedStatesOutlyingIslands ,
  VaticanCityState = VaticanCity , WallisAndFutunaIslands = WallisAndFutuna , LastTerritory = Zimbabwe , LastCountry = LastTerritory
}
 
enum  MeasurementSystem { MetricSystem , ImperialUSSystem , ImperialUKSystem , ImperialSystem = ImperialUSSystem }
 
enum  FormatType { LongFormat , ShortFormat , NarrowFormat }
 
enum  NumberOption {
  DefaultNumberOptions = 0x0 , OmitGroupSeparator = 0x01 , RejectGroupSeparator = 0x02 , OmitLeadingZeroInExponent = 0x04 ,
  RejectLeadingZeroInExponent = 0x08 , IncludeTrailingZeroesAfterDot = 0x10 , RejectTrailingZeroesAfterDot = 0x20
}
 
enum  FloatingPointPrecisionOption { FloatingPointShortest = -128 }
 
enum  CurrencySymbolFormat { CurrencyIsoCode , CurrencySymbol , CurrencyDisplayName }
 
enum  DataSizeFormat {
  DataSizeBase1000 = 1 , DataSizeSIQuantifiers = 2 , DataSizeIecFormat = 0 , DataSizeTraditionalFormat = DataSizeSIQuantifiers ,
  DataSizeSIFormat = DataSizeBase1000 | DataSizeSIQuantifiers
}
 
enum  LanguageCodeType {
  ISO639Part1 = 1 << 0 , ISO639Part2B = 1 << 1 , ISO639Part2T = 1 << 2 , ISO639Part3 = 1 << 3 ,
  LegacyLanguageCode = 1 << 15 , ISO639Part2 = ISO639Part2B | ISO639Part2T , ISO639Alpha2 = ISO639Part1 , ISO639Alpha3 = ISO639Part2 | ISO639Part3 ,
  ISO639 = ISO639Alpha2 | ISO639Alpha3 , AnyLanguageCode = -1
}
 
enum  QuotationStyle { StandardQuotation , AlternateQuotation }
 
using Territory = Country
 

Public Member Functions

 QLocale ()
 
 QLocale (const QString &name)
 
 QLocale (QStringView name)
 
 QLocale (Language language, Territory territory)
 
 QLocale (Language language, Script script=AnyScript, Territory territory=AnyTerritory)
 
 QLocale (const QLocale &other)
 
QLocaleoperator= (const QLocale &other)
 
 ~QLocale ()
 
void swap (QLocale &other) noexcept
 
Language language () const
 
Script script () const
 
Territory territory () const
 
QString name () const
 
QString bcp47Name () const
 
QString nativeLanguageName () const
 
QString nativeTerritoryName () const
 
short toShort (const QString &s, bool *ok=nullptr) const
 
ushort toUShort (const QString &s, bool *ok=nullptr) const
 
int toInt (const QString &s, bool *ok=nullptr) const
 
uint toUInt (const QString &s, bool *ok=nullptr) const
 
long toLong (const QString &s, bool *ok=nullptr) const
 
ulong toULong (const QString &s, bool *ok=nullptr) const
 
qlonglong toLongLong (const QString &s, bool *ok=nullptr) const
 
qulonglong toULongLong (const QString &s, bool *ok=nullptr) const
 
float toFloat (const QString &s, bool *ok=nullptr) const
 
double toDouble (const QString &s, bool *ok=nullptr) const
 
short toShort (QStringView s, bool *ok=nullptr) const
 
ushort toUShort (QStringView s, bool *ok=nullptr) const
 
int toInt (QStringView s, bool *ok=nullptr) const
 
uint toUInt (QStringView s, bool *ok=nullptr) const
 
long toLong (QStringView s, bool *ok=nullptr) const
 
ulong toULong (QStringView s, bool *ok=nullptr) const
 
qlonglong toLongLong (QStringView s, bool *ok=nullptr) const
 
qulonglong toULongLong (QStringView s, bool *ok=nullptr) const
 
float toFloat (QStringView s, bool *ok=nullptr) const
 
double toDouble (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 f, char format='g', int precision=6) const
 
QString toString (float f, char format='g', int precision=6) const
 
QString toString (QDate date, const QString &format) const
 
QString toString (QTime time, const QString &format) const
 
QString toString (const QDateTime &dateTime, const QString &format) const
 
QString toString (QDate date, QStringView format) const
 
QString toString (QTime time, QStringView format) const
 
QString toString (const QDateTime &dateTime, QStringView format) const
 
QString toString (QDate date, FormatType format=LongFormat) const
 
QString toString (QTime time, FormatType format=LongFormat) const
 
QString toString (const QDateTime &dateTime, FormatType format=LongFormat) const
 
QString toString (QDate date, QStringView format, QCalendar cal) const
 
QString toString (QDate date, FormatType format, QCalendar cal) const
 
QString toString (const QDateTime &dateTime, FormatType format, QCalendar cal) const
 
QString toString (const QDateTime &dateTime, QStringView format, QCalendar cal) const
 
QString dateFormat (FormatType format=LongFormat) const
 
QString timeFormat (FormatType format=LongFormat) const
 
QString dateTimeFormat (FormatType format=LongFormat) const
 
QString decimalPoint () const
 
QString groupSeparator () const
 
QString percent () const
 
QString zeroDigit () const
 
QString negativeSign () const
 
QString positiveSign () const
 
QString exponential () const
 
QString monthName (int, FormatType format=LongFormat) const
 
QString standaloneMonthName (int, FormatType format=LongFormat) const
 
QString dayName (int, FormatType format=LongFormat) const
 
QString standaloneDayName (int, FormatType format=LongFormat) const
 
Qt::DayOfWeek firstDayOfWeek () const
 
QList< Qt::DayOfWeekweekdays () const
 
QString amText () const
 
QString pmText () const
 
MeasurementSystem measurementSystem () const
 
QLocale collation () const
 
Qt::LayoutDirection textDirection () const
 
QString toUpper (const QString &str) const
 
QString toLower (const QString &str) const
 
QString currencySymbol (CurrencySymbolFormat=CurrencySymbol) const
 
QString toCurrencyString (qlonglong, const QString &symbol=QString()) const
 
QString toCurrencyString (qulonglong, const QString &symbol=QString()) const
 
QString toCurrencyString (short i, const QString &symbol=QString()) const
 
QString toCurrencyString (ushort i, const QString &symbol=QString()) const
 
QString toCurrencyString (int i, const QString &symbol=QString()) const
 
QString toCurrencyString (uint i, const QString &symbol=QString()) const
 
QString toCurrencyString (double, const QString &symbol=QString(), int precision=-1) const
 
QString toCurrencyString (float i, const QString &symbol=QString(), int precision=-1) const
 
QString formattedDataSize (qint64 bytes, int precision=2, DataSizeFormats format=DataSizeIecFormat) const
 
QStringList uiLanguages () const
 
void setNumberOptions (NumberOptions options)
 
NumberOptions numberOptions () const
 
QString quoteString (const QString &str, QuotationStyle style=StandardQuotation) const
 
QString quoteString (QStringView str, QuotationStyle style=StandardQuotation) const
 
QString createSeparatedList (const QStringList &strl) const
 

Static Public Member Functions

static QString languageToCode (Language language, LanguageCodeTypes codeTypes=AnyLanguageCode)
 
static Language codeToLanguage (QStringView languageCode, LanguageCodeTypes codeTypes=AnyLanguageCode) noexcept
 
static QString territoryToCode (Territory territory)
 
static Territory codeToTerritory (QStringView territoryCode) noexcept
 
static QString scriptToCode (Script script)
 
static Script codeToScript (QStringView scriptCode) noexcept
 
static QString languageToString (Language language)
 
static QString territoryToString (Territory territory)
 
static QString scriptToString (Script script)
 
static void setDefault (const QLocale &locale)
 
static QLocale c ()
 
static QLocale system ()
 
static QList< QLocalematchingLocales (QLocale::Language language, QLocale::Script script, QLocale::Territory territory)
 

Friends

class QString
 
class QByteArray
 
class QIntValidator
 
class QDoubleValidatorPrivate
 
class QTextStream
 
class QTextStreamPrivate
 
class QLocalePrivate
 
class QSystemLocale
 
class QCalendarBackend
 
class QGregorianCalendar
 
Q_CORE_EXPORT size_t qHash (const QLocale &key, size_t seed) noexcept
 
bool operator== (const QLocale &lhs, const QLocale &rhs)
 
bool operator!= (const QLocale &lhs, const QLocale &rhs)
 

Related Functions

(Note that these are not member functions.)

size_t qHash (const QLocale &key, size_t seed) noexcept
 

Detailed Description

Definition at line 64 of file qlocale.h.

Member Typedef Documentation

◆ Territory

Definition at line 880 of file qlocale.h.

Member Enumeration Documentation

◆ Country

Enumerator
AnyTerritory 
Afghanistan 
AlandIslands 
Albania 
Algeria 
AmericanSamoa 
Andorra 
Angola 
Anguilla 
Antarctica 
AntiguaAndBarbuda 
Argentina 
Armenia 
Aruba 
AscensionIsland 
Australia 
Austria 
Azerbaijan 
Bahamas 
Bahrain 
Bangladesh 
Barbados 
Belarus 
Belgium 
Belize 
Benin 
Bermuda 
Bhutan 
Bolivia 
BosniaAndHerzegovina 
Botswana 
BouvetIsland 
Brazil 
BritishIndianOceanTerritory 
BritishVirginIslands 
Brunei 
Bulgaria 
BurkinaFaso 
Burundi 
Cambodia 
Cameroon 
Canada 
CanaryIslands 
CapeVerde 
CaribbeanNetherlands 
CaymanIslands 
CentralAfricanRepublic 
CeutaAndMelilla 
Chad 
Chile 
China 
ChristmasIsland 
ClippertonIsland 
CocosIslands 
Colombia 
Comoros 
CongoBrazzaville 
CongoKinshasa 
CookIslands 
CostaRica 
Croatia 
Cuba 
Curacao 
Cyprus 
Czechia 
Denmark 
DiegoGarcia 
Djibouti 
Dominica 
DominicanRepublic 
Ecuador 
Egypt 
ElSalvador 
EquatorialGuinea 
Eritrea 
Estonia 
Eswatini 
Ethiopia 
Europe 
EuropeanUnion 
FalklandIslands 
FaroeIslands 
Fiji 
Finland 
France 
FrenchGuiana 
FrenchPolynesia 
FrenchSouthernTerritories 
Gabon 
Gambia 
Georgia 
Germany 
Ghana 
Gibraltar 
Greece 
Greenland 
Grenada 
Guadeloupe 
Guam 
Guatemala 
Guernsey 
GuineaBissau 
Guinea 
Guyana 
Haiti 
HeardAndMcDonaldIslands 
Honduras 
HongKong 
Hungary 
Iceland 
India 
Indonesia 
Iran 
Iraq 
Ireland 
IsleOfMan 
Israel 
Italy 
IvoryCoast 
Jamaica 
Japan 
Jersey 
Jordan 
Kazakhstan 
Kenya 
Kiribati 
Kosovo 
Kuwait 
Kyrgyzstan 
Laos 
LatinAmerica 
Latvia 
Lebanon 
Lesotho 
Liberia 
Libya 
Liechtenstein 
Lithuania 
Luxembourg 
Macao 
Macedonia 
Madagascar 
Malawi 
Malaysia 
Maldives 
Mali 
Malta 
MarshallIslands 
Martinique 
Mauritania 
Mauritius 
Mayotte 
Mexico 
Micronesia 
Moldova 
Monaco 
Mongolia 
Montenegro 
Montserrat 
Morocco 
Mozambique 
Myanmar 
Namibia 
NauruTerritory 
Nepal 
Netherlands 
NewCaledonia 
NewZealand 
Nicaragua 
Nigeria 
Niger 
Niue 
NorfolkIsland 
NorthernMarianaIslands 
NorthKorea 
Norway 
Oman 
OutlyingOceania 
Pakistan 
Palau 
PalestinianTerritories 
Panama 
PapuaNewGuinea 
Paraguay 
Peru 
Philippines 
Pitcairn 
Poland 
Portugal 
PuertoRico 
Qatar 
Reunion 
Romania 
Russia 
Rwanda 
SaintBarthelemy 
SaintHelena 
SaintKittsAndNevis 
SaintLucia 
SaintMartin 
SaintPierreAndMiquelon 
SaintVincentAndGrenadines 
Samoa 
SanMarino 
SaoTomeAndPrincipe 
SaudiArabia 
Senegal 
Serbia 
Seychelles 
SierraLeone 
Singapore 
SintMaarten 
Slovakia 
Slovenia 
SolomonIslands 
Somalia 
SouthAfrica 
SouthGeorgiaAndSouthSandwichIslands 
SouthKorea 
SouthSudan 
Spain 
SriLanka 
Sudan 
Suriname 
SvalbardAndJanMayen 
Sweden 
Switzerland 
Syria 
Taiwan 
Tajikistan 
Tanzania 
Thailand 
TimorLeste 
Togo 
TokelauTerritory 
Tonga 
TrinidadAndTobago 
TristanDaCunha 
Tunisia 
Turkey 
Turkmenistan 
TurksAndCaicosIslands 
TuvaluTerritory 
Uganda 
Ukraine 
UnitedArabEmirates 
UnitedKingdom 
UnitedStatesOutlyingIslands 
UnitedStates 
UnitedStatesVirginIslands 
Uruguay 
Uzbekistan 
Vanuatu 
VaticanCity 
Venezuela 
Vietnam 
WallisAndFutuna 
WesternSahara 
World 
Yemen 
Zambia 
Zimbabwe 
AnyCountry 
Bonaire 
BosniaAndHerzegowina 
CuraSao 
CzechRepublic 
DemocraticRepublicOfCongo 
DemocraticRepublicOfKorea 
EastTimor 
LatinAmericaAndTheCaribbean 
Macau 
NauruCountry 
PeoplesRepublicOfCongo 
RepublicOfKorea 
RussianFederation 
SaintVincentAndTheGrenadines 
SouthGeorgiaAndTheSouthSandwichIslands 
SvalbardAndJanMayenIslands 
Swaziland 
SyrianArabRepublic 
TokelauCountry 
TuvaluCountry 
UnitedStatesMinorOutlyingIslands 
VaticanCityState 
WallisAndFutunaIslands 
LastTerritory 
LastCountry 

Definition at line 586 of file qlocale.h.

◆ CurrencySymbolFormat

Since
4.8

Specifies the format of the currency symbol.

\value CurrencyIsoCode a ISO-4217 code of the currency. \value CurrencySymbol a currency symbol. \value CurrencyDisplayName a user readable name of the currency.

Enumerator
CurrencyIsoCode 
CurrencySymbol 
CurrencyDisplayName 

Definition at line 910 of file qlocale.h.

◆ DataSizeFormat

Since
5.10

Specifies the format for representation of data quantities.

\omitvalue DataSizeBase1000 \omitvalue DataSizeSIQuantifiers \value DataSizeIecFormat format using base 1024 and IEC prefixes: KiB, MiB, GiB, ... \value DataSizeTraditionalFormat format using base 1024 and SI prefixes: kB, MB, GB, ... \value DataSizeSIFormat format using base 1000 and SI prefixes: kB, MB, GB, ...

See also
formattedDataSize()
Enumerator
DataSizeBase1000 
DataSizeSIQuantifiers 
DataSizeIecFormat 
DataSizeTraditionalFormat 
DataSizeSIFormat 

Definition at line 916 of file qlocale.h.

◆ FloatingPointPrecisionOption

Enumerator
FloatingPointShortest 

Definition at line 906 of file qlocale.h.

◆ FormatType

Enumerator
LongFormat 
ShortFormat 
NarrowFormat 

Definition at line 894 of file qlocale.h.

◆ Language

Enumerator
AnyLanguage 
Abkhazian 
Afar 
Afrikaans 
Aghem 
Akan 
Akkadian 
Akoose 
Albanian 
AmericanSignLanguage 
Amharic 
AncientEgyptian 
AncientGreek 
Arabic 
Aragonese 
Aramaic 
Armenian 
Assamese 
Asturian 
Asu 
Atsam 
Avaric 
Avestan 
Aymara 
Azerbaijani 
Bafia 
Balinese 
Bambara 
Bamun 
Bangla 
Basaa 
Bashkir 
Basque 
BatakToba 
Belarusian 
Bemba 
Bena 
Bhojpuri 
Bislama 
Blin 
Bodo 
Bosnian 
Breton 
Buginese 
Bulgarian 
Burmese 
Cantonese 
Catalan 
Cebuano 
CentralAtlasTamazight 
CentralKurdish 
Chakma 
Chamorro 
Chechen 
Cherokee 
Chickasaw 
Chiga 
Chinese 
Church 
Chuvash 
Colognian 
Coptic 
Cornish 
Corsican 
Cree 
Croatian 
Czech 
Danish 
Divehi 
Dogri 
Duala 
Dutch 
Dzongkha 
Embu 
English 
Erzya 
Esperanto 
Estonian 
Ewe 
Ewondo 
Faroese 
Fijian 
Filipino 
Finnish 
French 
Friulian 
Fulah 
Gaelic 
Ga 
Galician 
Ganda 
Geez 
Georgian 
German 
Gothic 
Greek 
Guarani 
Gujarati 
Gusii 
Haitian 
Hausa 
Hawaiian 
Hebrew 
Herero 
Hindi 
HiriMotu 
Hungarian 
Icelandic 
Ido 
Igbo 
InariSami 
Indonesian 
Ingush 
Interlingua 
Interlingue 
Inuktitut 
Inupiaq 
Irish 
Italian 
Japanese 
Javanese 
Jju 
JolaFonyi 
Kabuverdianu 
Kabyle 
Kako 
Kalaallisut 
Kalenjin 
Kamba 
Kannada 
Kanuri 
Kashmiri 
Kazakh 
Kenyang 
Khmer 
Kiche 
Kikuyu 
Kinyarwanda 
Komi 
Kongo 
Konkani 
Korean 
Koro 
KoyraboroSenni 
KoyraChiini 
Kpelle 
Kuanyama 
Kurdish 
Kwasio 
Kyrgyz 
Lakota 
Langi 
Lao 
Latin 
Latvian 
Lezghian 
Limburgish 
Lingala 
LiteraryChinese 
Lithuanian 
Lojban 
LowerSorbian 
LowGerman 
LubaKatanga 
LuleSami 
Luo 
Luxembourgish 
Luyia 
Macedonian 
Machame 
Maithili 
MakhuwaMeetto 
Makonde 
Malagasy 
Malayalam 
Malay 
Maltese 
Mandingo 
Manipuri 
Manx 
Maori 
Mapuche 
Marathi 
Marshallese 
Masai 
Mazanderani 
Mende 
Meru 
Meta 
Mohawk 
Mongolian 
Morisyen 
Mundang 
Muscogee 
Nama 
NauruLanguage 
Navajo 
Ndonga 
Nepali 
Newari 
Ngiemboon 
Ngomba 
NigerianPidgin 
Nko 
NorthernLuri 
NorthernSami 
NorthernSotho 
NorthNdebele 
NorwegianBokmal 
NorwegianNynorsk 
Nuer 
Nyanja 
Nyankole 
Occitan 
Odia 
Ojibwa 
OldIrish 
OldNorse 
OldPersian 
Oromo 
Osage 
Ossetic 
Pahlavi 
Palauan 
Pali 
Papiamento 
Pashto 
Persian 
Phoenician 
Polish 
Portuguese 
Prussian 
Punjabi 
Quechua 
Romanian 
Romansh 
Rombo 
Rundi 
Russian 
Rwa 
Saho 
Sakha 
Samburu 
Samoan 
Sango 
Sangu 
Sanskrit 
Santali 
Sardinian 
Saurashtra 
Sena 
Serbian 
Shambala 
Shona 
SichuanYi 
Sicilian 
Sidamo 
Silesian 
Sindhi 
Sinhala 
SkoltSami 
Slovak 
Slovenian 
Soga 
Somali 
SouthernKurdish 
SouthernSami 
SouthernSotho 
SouthNdebele 
Spanish 
StandardMoroccanTamazight 
Sundanese 
Swahili 
Swati 
Swedish 
SwissGerman 
Syriac 
Tachelhit 
Tahitian 
TaiDam 
Taita 
Tajik 
Tamil 
Taroko 
Tasawaq 
Tatar 
Telugu 
Teso 
Thai 
Tibetan 
Tigre 
Tigrinya 
TokelauLanguage 
TokPisin 
Tongan 
Tsonga 
Tswana 
Turkish 
Turkmen 
TuvaluLanguage 
Tyap 
Ugaritic 
Ukrainian 
UpperSorbian 
Urdu 
Uyghur 
Uzbek 
Vai 
Venda 
Vietnamese 
Volapuk 
Vunjo 
Walloon 
Walser 
Warlpiri 
Welsh 
WesternBalochi 
WesternFrisian 
Wolaytta 
Wolof 
Xhosa 
Yangben 
Yiddish 
Yoruba 
Zarma 
Zhuang 
Zulu 
Kaingang 
Nheengatu 
Afan 
Bengali 
Bhutani 
Byelorussian 
Cambodian 
CentralMoroccoTamazight 
Chewa 
Frisian 
Greenlandic 
Inupiak 
Kirghiz 
Kurundi 
Kwanyama 
Navaho 
Oriya 
RhaetoRomance 
Uighur 
Uigur 
Walamo 
LastLanguage 

Definition at line 77 of file qlocale.h.

◆ LanguageCodeType

Enumerator
ISO639Part1 
ISO639Part2B 
ISO639Part2T 
ISO639Part3 
LegacyLanguageCode 
ISO639Part2 
ISO639Alpha2 
ISO639Alpha3 
ISO639 
AnyLanguageCode 

Definition at line 1091 of file qlocale.h.

◆ MeasurementSystem

Enumerator
MetricSystem 
ImperialUSSystem 
ImperialUKSystem 
ImperialSystem 

Definition at line 886 of file qlocale.h.

◆ NumberOption

Enumerator
DefaultNumberOptions 
OmitGroupSeparator 
RejectGroupSeparator 
OmitLeadingZeroInExponent 
RejectLeadingZeroInExponent 
IncludeTrailingZeroesAfterDot 
RejectTrailingZeroesAfterDot 

Definition at line 895 of file qlocale.h.

◆ QuotationStyle

Enumerator
StandardQuotation 
AlternateQuotation 

Definition at line 1147 of file qlocale.h.

◆ Script

Enumerator
AnyScript 
AdlamScript 
AhomScript 
AnatolianHieroglyphsScript 
ArabicScript 
ArmenianScript 
AvestanScript 
BalineseScript 
BamumScript 
BanglaScript 
BassaVahScript 
BatakScript 
BhaiksukiScript 
BopomofoScript 
BrahmiScript 
BrailleScript 
BugineseScript 
BuhidScript 
CanadianAboriginalScript 
CarianScript 
CaucasianAlbanianScript 
ChakmaScript 
ChamScript 
CherokeeScript 
CopticScript 
CuneiformScript 
CypriotScript 
CyrillicScript 
DeseretScript 
DevanagariScript 
DuployanScript 
EgyptianHieroglyphsScript 
ElbasanScript 
EthiopicScript 
FraserScript 
GeorgianScript 
GlagoliticScript 
GothicScript 
GranthaScript 
GreekScript 
GujaratiScript 
GurmukhiScript 
HangulScript 
HanScript 
HanunooScript 
HanWithBopomofoScript 
HatranScript 
HebrewScript 
HiraganaScript 
ImperialAramaicScript 
InscriptionalPahlaviScript 
InscriptionalParthianScript 
JamoScript 
JapaneseScript 
JavaneseScript 
KaithiScript 
KannadaScript 
KatakanaScript 
KayahLiScript 
KharoshthiScript 
KhmerScript 
KhojkiScript 
KhudawadiScript 
KoreanScript 
LannaScript 
LaoScript 
LatinScript 
LepchaScript 
LimbuScript 
LinearAScript 
LinearBScript 
LycianScript 
LydianScript 
MahajaniScript 
MalayalamScript 
MandaeanScript 
ManichaeanScript 
MarchenScript 
MeiteiMayekScript 
MendeScript 
MeroiticCursiveScript 
MeroiticScript 
ModiScript 
MongolianScript 
MroScript 
MultaniScript 
MyanmarScript 
NabataeanScript 
NewaScript 
NewTaiLueScript 
NkoScript 
OdiaScript 
OghamScript 
OlChikiScript 
OldHungarianScript 
OldItalicScript 
OldNorthArabianScript 
OldPermicScript 
OldPersianScript 
OldSouthArabianScript 
OrkhonScript 
OsageScript 
OsmanyaScript 
PahawhHmongScript 
PalmyreneScript 
PauCinHauScript 
PhagsPaScript 
PhoenicianScript 
PollardPhoneticScript 
PsalterPahlaviScript 
RejangScript 
RunicScript 
SamaritanScript 
SaurashtraScript 
SharadaScript 
ShavianScript 
SiddhamScript 
SignWritingScript 
SimplifiedHanScript 
SinhalaScript 
SoraSompengScript 
SundaneseScript 
SylotiNagriScript 
SyriacScript 
TagalogScript 
TagbanwaScript 
TaiLeScript 
TaiVietScript 
TakriScript 
TamilScript 
TangutScript 
TeluguScript 
ThaanaScript 
ThaiScript 
TibetanScript 
TifinaghScript 
TirhutaScript 
TraditionalHanScript 
UgariticScript 
VaiScript 
VarangKshitiScript 
YiScript 
BengaliScript 
MendeKikakuiScript 
OriyaScript 
SimplifiedChineseScript 
TraditionalChineseScript 
LastScript 

Definition at line 432 of file qlocale.h.

Constructor & Destructor Documentation

◆ QLocale() [1/6]

QLocale::QLocale ( )

Constructs a QLocale object initialized with the default locale.

If no default locale was set using setDefault(), this locale will be the same as the one returned by system().

See also
setDefault(), system()

Definition at line 1039 of file qlocale.cpp.

Here is the caller graph for this function:

◆ QLocale() [2/6]

QLocale::QLocale ( const QString name)
explicit

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1027 of file qlocale.cpp.

◆ QLocale() [3/6]

QLocale::QLocale ( QStringView  name)
explicit
Since
6.3

Constructs a QLocale object with the specified name.

The name has the format "language[_script][_territory][.codeset][@modifier]" or "C", where:

\list

  • language is a lowercase, two-letter, ISO 639 language code (some three-letter codes are also recognized),
  • script is a capitalized, four-letter, ISO 15924 script code,
  • territory is an uppercase, two-letter, ISO 3166 territory code (some numeric codes are also recognized), and
  • codeset and modifier are ignored. \endlist

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).

See also
bcp47Name(), {Matching combinations of language, script and territory}

Definition at line 1018 of file qlocale.cpp.

◆ QLocale() [4/6]

QLocale::QLocale ( Language  language,
Territory  territory 
)

Constructs a QLocale object for the specified language and territory.

If there is more than one script in use for this combination, a likely script will be selected. If QLocale has no data for the specified language, the default locale is used. If QLocale has no data for the specified combination of language and territory, an alternative territory may be used instead.

See also
setDefault(), {Matching combinations of language, script and territory}

Definition at line 1058 of file qlocale.cpp.

◆ QLocale() [5/6]

QLocale::QLocale ( Language  language,
Script  script = AnyScript,
Territory  territory = AnyTerritory 
)
Since
4.8

Constructs a QLocale object for the specified language, script and territory.

If QLocale does not have data for the given combination, it will find data for as good a match as it can. It falls back on the default locale if

\list

  • language is AnyLanguage and no language can be inferred from script and territory
  • QLocale has no data for the language, either given as language or inferred as above. \endlist
See also
setDefault(), {Matching combinations of language, script and territory}

Definition at line 1082 of file qlocale.cpp.

◆ QLocale() [6/6]

QLocale::QLocale ( const QLocale other)

Constructs a QLocale object as a copy of other.

Definition at line 1091 of file qlocale.cpp.

Here is the call graph for this function:

◆ ~QLocale()

QLocale::~QLocale ( )

Destructor

Definition at line 1100 of file qlocale.cpp.

Member Function Documentation

◆ amText()

QString QLocale::amText ( ) const
Since
4.5

Returns the localized name of the "AM" suffix for times specified using the conventions of the 12-hour clock.

See also
pmText()

Definition at line 3285 of file qlocale.cpp.

Here is the caller graph for this function:

◆ bcp47Name()

QString QLocale::bcp47Name ( ) const
Since
4.8

Returns the dash-separated language, script and country (and possibly other BCP47 fields) of this locale as a string.

Unlike the 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.

This function tries to conform the locale name to BCP47.

See also
language(), territory(), script(), uiLanguages()

Definition at line 1405 of file qlocale.cpp.

Here is the call graph for this function:

◆ c()

QLocale QLocale::c ( )
inlinestatic

Returns a QLocale object initialized to the "C" locale.

This locale is based on en_US but with various quirks of its own, such as simplified number formatting and its own date formatting. It implements the POSIX standards that describe the behavior of standard library functions of the "C" programming language.

Among other things, this means its collation order is based on the ASCII values of letters, so that (for case-sensitive sorting) all upper-case letters sort before any lower-case one (rather than each letter's upper- and lower-case forms sorting adjacent to one another, before the next letter's two forms).

See also
system()

Definition at line 1134 of file qlocale.h.

Here is the caller graph for this function:

◆ codeToLanguage()

QLocale::Language QLocale::codeToLanguage ( QStringView  languageCode,
LanguageCodeTypes  codeTypes = AnyLanguageCode 
)
staticnoexcept

Returns the QLocale::Language enum corresponding to the two- or three-letter languageCode, as defined in the ISO 639 standards.

If specified, codeTypes selects which set of codes to consider for conversion. By default all codes known to Qt are considered. The codes are matched in the following order: ISO639Part1, ISO639Part2B, ISO639Part2T, ISO639Part3, LegacyLanguageCode.

If the code is invalid or not known QLocale::AnyLanguage is returned.

Since
6.3
See also
languageToCode(), codeToTerritory(), codeToScript()

Definition at line 1447 of file qlocale.cpp.

Here is the call graph for this function:

◆ codeToScript()

QLocale::Script QLocale::codeToScript ( QStringView  scriptCode)
staticnoexcept

Returns the QLocale::Script enum corresponding to the four-letter script scriptCode, as defined in the ISO 15924 standard.

If the code is invalid or not known QLocale::AnyScript is returned.

Since
6.1
See also
scriptToCode(), codeToLanguage(), codeToTerritory()

Definition at line 1538 of file qlocale.cpp.

Here is the call graph for this function:

◆ codeToTerritory()

QLocale::Territory QLocale::codeToTerritory ( QStringView  territoryCode)
staticnoexcept
Since
6.2

Returns the QLocale::Territory enum corresponding to the two-letter or three-digit territoryCode, as defined in the ISO 3166 standard.

If the code is invalid or not known QLocale::AnyTerritory is returned.

See also
territoryToCode(), codeToLanguage(), codeToScript()

Definition at line 1478 of file qlocale.cpp.

Here is the call graph for this function:

◆ collation()

QLocale QLocale::collation ( ) const
Since
5.13

Returns the locale to use for collation.

The result is usually this locale; however, the system locale (which is commonly the default locale) will return the system collation locale. The result is suitable for passing to QCollator's constructor.

See also
QCollator

Definition at line 4504 of file qlocale.cpp.

◆ createSeparatedList()

QString QLocale::createSeparatedList ( const QStringList list) const
Since
4.8

Returns a string that represents a join of a given list of strings with a separator defined by the locale.

Definition at line 1222 of file qlocale.cpp.

Here is the caller graph for this function:

◆ currencySymbol()

QString QLocale::currencySymbol ( QLocale::CurrencySymbolFormat  format = CurrencySymbol) const
Since
4.8 Returns a currency symbol according to the format.

Definition at line 4236 of file qlocale.cpp.

Here is the caller graph for this function:

◆ dateFormat()

QString QLocale::dateFormat ( FormatType  format = LongFormat) const
Since
4.1

Returns the date format used for the current locale.

If format is LongFormat, the format will be elaborate, otherwise it will be short. For example, LongFormat for the {en_US} locale is {dddd, MMMM d, yyyy}, ShortFormat is {M/d/yy}.

See also
QDate::toString(), QDate::fromString()

Definition at line 2265 of file qlocale.cpp.

Here is the caller graph for this function:

◆ dateTimeFormat()

QString QLocale::dateTimeFormat ( FormatType  format = LongFormat) const
Since
4.4

Returns the date time format used for the current locale.

If format is LongFormat, the format will be elaborate, otherwise it will be short. For example, LongFormat for the {en_US} locale is {dddd, MMMM d, yyyy h:mm:ss AP t}, ShortFormat is {M/d/yy h:mm AP}.

See also
QDateTime::toString(), QDateTime::fromString()

Definition at line 2327 of file qlocale.cpp.

Here is the caller graph for this function:

◆ dayName()

QString QLocale::dayName ( int  day,
FormatType  type = LongFormat 
) const
Since
4.2

Returns the localized name of the day (where 1 represents Monday, 2 represents Tuesday and so on), in the format specified by type.

For example, if the locale is en_US and day is 1, \l LongFormat will return Monday, \l ShortFormat Mon, and \l NarrowFormat M.

See also
monthName(), standaloneDayName()

Definition at line 2853 of file qlocale.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decimalPoint()

QString QLocale::decimalPoint ( ) const
Since
4.1

Returns the decimal point character of this locale.

See also
groupSeparator(), toString()

Definition at line 2549 of file qlocale.cpp.

Here is the caller graph for this function:

◆ exponential()

QString QLocale::exponential ( ) const
Since
4.1

Returns the exponential character of this locale, used to separate exponent from mantissa in some floating-point numeric representations.

See also
toString(double, char, int)

Definition at line 2622 of file qlocale.cpp.

◆ firstDayOfWeek()

Qt::DayOfWeek QLocale::firstDayOfWeek ( ) const
Since
4.8

Returns the first day of the week according to the current locale.

Definition at line 3118 of file qlocale.cpp.

Here is the caller graph for this function:

◆ formattedDataSize()

QString QLocale::formattedDataSize ( qint64  bytes,
int  precision = 2,
DataSizeFormats  format = DataSizeIecFormat 
) const
Since
5.10

Converts a size in bytes to a human-readable localized string, comprising a number and a quantified unit. The quantifier is chosen such that the number is at least one, and as small as possible. For example if bytes is 16384, precision is 2, and format is \l DataSizeIecFormat (the default), this function returns "16.00 KiB"; for 1330409069609 bytes it returns "1.21 GiB"; and so on. If format is \l DataSizeIecFormat or \l DataSizeTraditionalFormat, the given number of bytes is divided by a power of 1024, with result less than 1024; for \l DataSizeSIFormat, it is divided by a power of 1000, with result less than 1000. DataSizeIecFormat uses the new IEC standard quantifiers Ki, Mi and so on, whereas DataSizeSIFormat uses the older SI quantifiers k, M, etc., and DataSizeTraditionalFormat abuses them.

Definition at line 4383 of file qlocale.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ groupSeparator()

QString QLocale::groupSeparator ( ) const
Since
4.1

Returns the group separator character of this locale.

See also
decimalPoint(), toString()

Definition at line 2561 of file qlocale.cpp.

Here is the caller graph for this function:

◆ language()

QLocale::Language QLocale::language ( ) const

Returns the language of this locale.

See also
script(), territory(), languageToString(), bcp47Name()

Definition at line 1293 of file qlocale.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ languageToCode()

QString QLocale::languageToCode ( Language  language,
LanguageCodeTypes  codeTypes = AnyLanguageCode 
)
static

Returns the two- or three-letter language code for language, as defined in the ISO 639 standards.

If specified, codeTypes selects which set of codes to consider. The first code from the set that is defined for language is returned. Otherwise, all ISO-639 codes are considered. The codes are considered in the following order: ISO639Part1, ISO639Part2B, ISO639Part2T, ISO639Part3. LegacyLanguageCode is ignored by this function.

Note
For {QLocale::C} the function returns {"C"}. For QLocale::AnyLanguage an empty string is returned. If the language has no code in any selected code set, an empty string is returned.
Since
6.3
See also
codeToLanguage(), language(), name(), bcp47Name(), territoryToCode(), scriptToCode()

Definition at line 1428 of file qlocale.cpp.

Here is the call graph for this function:

◆ languageToString()

QString QLocale::languageToString ( Language  language)
static

Returns a QString containing the name of language.

See also
territoryToString(), scriptToString(), bcp47Name()

Definition at line 1549 of file qlocale.cpp.

Here is the caller graph for this function:

◆ matchingLocales()

QList< QLocale > QLocale::matchingLocales ( QLocale::Language  language,
QLocale::Script  script,
QLocale::Territory  territory 
)
static

Returns a list of valid locale objects that match the given language, script and territory.

Getting a list of all locales: QList<QLocale> allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyTerritory);

Getting a list of locales suitable for Russia: QList<QLocale> locales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::Russia);

Definition at line 2757 of file qlocale.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ measurementSystem()

QLocale::MeasurementSystem QLocale::measurementSystem ( ) const
Since
4.4

Returns the measurement system for the locale.

Definition at line 3172 of file qlocale.cpp.

◆ monthName()

QString QLocale::monthName ( int  month,
FormatType  type = LongFormat 
) const
Since
4.2

Returns the localized name of month, in the format specified by type.

For example, if the locale is en_US and month is 1, \l LongFormat will return January. \l ShortFormat Jan, and \l NarrowFormat J.

See also
dayName(), standaloneMonthName()

Definition at line 2819 of file qlocale.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ name()

QString QLocale::name ( ) const

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 \l bcp47Name() instead if you need a full locale name.

See also
QLocale(), language(), script(), territory(), bcp47Name()

Definition at line 1349 of file qlocale.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nativeLanguageName()

QString QLocale::nativeLanguageName ( ) const
Since
4.8

Returns a native name of the language for the locale. For example "Schwiizertüütsch" for Swiss-German locale.

See also
nativeTerritoryName(), languageToString()

Definition at line 4524 of file qlocale.cpp.

◆ nativeTerritoryName()

QString QLocale::nativeTerritoryName ( ) const
Since
6.2

Returns a native name of the territory for the locale. For example "España" for Spanish/Spain locale.

See also
nativeLanguageName(), territoryToString()

Definition at line 4544 of file qlocale.cpp.

◆ negativeSign()

QString QLocale::negativeSign ( ) const
Since
4.1

Returns the negative sign character of this locale.

See also
positiveSign(), toString()

Definition at line 2597 of file qlocale.cpp.

Here is the caller graph for this function:

◆ numberOptions()

QLocale::NumberOptions QLocale::numberOptions ( ) const
Since
4.2

Returns the options related to number conversions for this QLocale instance.

By default, no options are set for the standard locales, except for the "C" locale, which has OmitGroupSeparator set by default.

See also
setNumberOptions(), toString(), groupSeparator(), FloatingPointPrecisionOption

Definition at line 1169 of file qlocale.cpp.

Here is the caller graph for this function:

◆ operator=()

QLocale & QLocale::operator= ( const QLocale other)

Assigns other to this QLocale object and returns a reference to this QLocale object.

Definition at line 1109 of file qlocale.cpp.

Here is the call graph for this function:

◆ percent()

QString QLocale::percent ( ) const
Since
4.1

Returns the percent character of this locale.

See also
toString()

Definition at line 2573 of file qlocale.cpp.

Here is the caller graph for this function:

◆ pmText()

QString QLocale::pmText ( ) const
Since
4.5

Returns the localized name of the "PM" suffix for times specified using the conventions of the 12-hour clock.

See also
amText()

Definition at line 3305 of file qlocale.cpp.

Here is the caller graph for this function:

◆ positiveSign()

QString QLocale::positiveSign ( ) const
Since
4.5

Returns the positive sign character of this locale.

See also
negativeSign(), toString()

Definition at line 2609 of file qlocale.cpp.

Here is the caller graph for this function:

◆ quoteString() [1/2]

QString QLocale::quoteString ( const QString str,
QuotationStyle  style = StandardQuotation 
) const
inline
Since
4.8

Returns str quoted according to the current locale using the given quotation style.

Definition at line 1148 of file qlocale.h.

Here is the caller graph for this function:

◆ quoteString() [2/2]

QString QLocale::quoteString ( QStringView  str,
QuotationStyle  style = StandardQuotation 
) const
Since
6.0

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1188 of file qlocale.cpp.

◆ script()

QLocale::Script QLocale::script ( ) const
Since
4.8

Returns the script of this locale.

See also
language(), territory(), languageToString(), scriptToString(), bcp47Name()

Definition at line 1305 of file qlocale.cpp.

Here is the caller graph for this function:

◆ scriptToCode()

QString QLocale::scriptToCode ( Script  script)
static

Returns the four-letter script code for script, as defined in the ISO 15924 standard.

Note
For {QLocale::AnyScript} an empty string is returned.
Since
6.1
See also
script(), name(), bcp47Name(), languageToCode(), territoryToCode()

Definition at line 1524 of file qlocale.cpp.

Here is the call graph for this function:

◆ scriptToString()

QString QLocale::scriptToString ( QLocale::Script  script)
static
Since
4.8

Returns a QString containing the name of script.

See also
languageToString(), territoryToString(), script(), bcp47Name()

Definition at line 1591 of file qlocale.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDefault()

void QLocale::setDefault ( const QLocale locale)
static

\nonreentrant

Sets the global default locale to locale. These values are used when a QLocale object is constructed with no arguments. If this function is not called, the system's locale is used.

Warning
In a multithreaded application, the default locale should be set at application startup, before any non-GUI threads are created.
See also
system(), c()

Definition at line 1271 of file qlocale.cpp.

Here is the caller graph for this function:

◆ setNumberOptions()

void QLocale::setNumberOptions ( NumberOptions  options)
Since
4.2

Sets the options related to number conversions for this QLocale instance.

See also
numberOptions(), FloatingPointPrecisionOption

Definition at line 1153 of file qlocale.cpp.

Here is the caller graph for this function:

◆ standaloneDayName()

QString QLocale::standaloneDayName ( int  day,
FormatType  type = LongFormat 
) const
Since
4.5

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().

See also
dayName(), standaloneMonthName()

Definition at line 2870 of file qlocale.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ standaloneMonthName()

QString QLocale::standaloneMonthName ( int  month,
FormatType  type = LongFormat 
) const
Since
4.5

Returns the localized name of month that is used as a standalone text, in the format specified by type.

If the locale information doesn't specify the standalone month name then return value is the same as in monthName().

See also
monthName(), standaloneDayName()

Definition at line 2835 of file qlocale.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swap()

void QLocale::swap ( QLocale other)
inlinenoexcept
Since
5.6

Swaps locale other with this locale. This operation is very fast and never fails.

Definition at line 941 of file qlocale.h.

Here is the call graph for this function:

◆ system()

QLocale QLocale::system ( )
static

Returns a QLocale object initialized to the system locale.

The system locale may use system-specific sources for locale data, where available, otherwise falling back on QLocale's built-in database entry for the language, script and territory the system reports.

For example, on Windows and Mac, this locale will use the decimal/grouping characters and date/time formats specified in the system configuration panel.

See also
c()

Definition at line 2737 of file qlocale.cpp.

Here is the caller graph for this function:

◆ territory()

QLocale::Territory QLocale::territory ( ) const
Since
6.2

Returns the territory of this locale.

See also
language(), script(), territoryToString(), bcp47Name()

Definition at line 1317 of file qlocale.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ territoryToCode()

QString QLocale::territoryToCode ( QLocale::Territory  territory)
static
Since
6.2

Returns the two-letter territory code for territory, as defined in the ISO 3166 standard.

Note
For {QLocale::AnyTerritory} an empty string is returned.
See also
codeToTerritory(), territory(), name(), bcp47Name(), languageToCode(), scriptToCode()

Definition at line 1463 of file qlocale.cpp.

Here is the call graph for this function:

◆ territoryToString()

QString QLocale::territoryToString ( QLocale::Territory  territory)
static
Since
6.2

Returns a QString containing the name of territory.

See also
languageToString(), scriptToString(), territory(), bcp47Name()

Definition at line 1563 of file qlocale.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textDirection()

Qt::LayoutDirection QLocale::textDirection ( ) const
Since
4.7

Returns the text direction of the language.

Definition at line 3190 of file qlocale.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timeFormat()

QString QLocale::timeFormat ( FormatType  format = LongFormat) const
Since
4.1

Returns the time format used for the current locale.

If format is LongFormat, the format will be elaborate, otherwise it will be short. For example, LongFormat for the {en_US} locale is {h:mm:ss AP t}, ShortFormat is {h:mm AP}.

See also
QTime::toString(), QTime::fromString()

Definition at line 2296 of file qlocale.cpp.

Here is the caller graph for this function:

◆ toCurrencyString() [1/8]

QString QLocale::toCurrencyString ( double  value,
const QString symbol = QString(),
int  precision = -1 
) const

Definition at line 4323 of file qlocale.cpp.

◆ toCurrencyString() [2/8]

QString QLocale::toCurrencyString ( float  i,
const QString symbol = QString(),
int  precision = -1 
) const
inline

Definition at line 1084 of file qlocale.h.

◆ toCurrencyString() [3/8]

QString QLocale::toCurrencyString ( int  i,
const QString symbol = QString() 
) const
inline

Definition at line 1079 of file qlocale.h.

◆ toCurrencyString() [4/8]

QString QLocale::toCurrencyString ( qlonglong  value,
const QString symbol = QString() 
) const
Since
4.8

Returns a localized string representation of value as a currency. If the symbol is provided it is used instead of the default currency symbol.

See also
currencySymbol()

Definition at line 4268 of file qlocale.cpp.

Here is the caller graph for this function:

◆ toCurrencyString() [5/8]

QString QLocale::toCurrencyString ( qulonglong  value,
const QString symbol = QString() 
) const
Since
4.8 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 4295 of file qlocale.cpp.

◆ toCurrencyString() [6/8]

QString QLocale::toCurrencyString ( short  i,
const QString symbol = QString() 
) const
inline

Definition at line 1075 of file qlocale.h.

◆ toCurrencyString() [7/8]

QString QLocale::toCurrencyString ( uint  i,
const QString symbol = QString() 
) const
inline

Definition at line 1081 of file qlocale.h.

◆ toCurrencyString() [8/8]

QString QLocale::toCurrencyString ( ushort  i,
const QString symbol = QString() 
) const
inline

Definition at line 1077 of file qlocale.h.

◆ toDouble() [1/2]

double QLocale::toDouble ( const QString s,
bool *  ok = nullptr 
) const
inline

Returns the double represented by the localized string s.

Returns an infinity if the conversion overflows or 0.0 if the conversion fails for any other reason (e.g. underflow).

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function does not fall back to the 'C' locale if the string cannot be interpreted in this locale.

Notice that the last conversion returns 1234.0, because '.' is the thousands group separator in the German locale.

This function ignores leading and trailing whitespace.

See also
toFloat(), toInt(), toString()

Definition at line 979 of file qlocale.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toDouble() [2/2]

double QLocale::toDouble ( QStringView  s,
bool *  ok = nullptr 
) const

Returns the double represented by the localized string s.

Returns an infinity if the conversion overflows or 0.0 if the conversion fails for any other reason (e.g. underflow).

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

Unlike QString::toDouble(), this function does not fall back to the "C" locale if the string cannot be interpreted in this locale.

Notice that the last conversion returns 1234.0, because '.' is the thousands group separator in the German locale.

This function ignores leading and trailing whitespace.

See also
toFloat(), toInt(), toString()
Since
5.10

Definition at line 1970 of file qlocale.cpp.

◆ toFloat() [1/2]

float QLocale::toFloat ( const QString s,
bool *  ok = nullptr 
) const
inline

Returns the float represented by the localized string s.

Returns an infinity if the conversion overflows or 0.0 if the conversion fails for any other reason (e.g. underflow).

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function does not fall back to the 'C' locale if the string cannot be interpreted in this locale.

This function ignores leading and trailing whitespace.

See also
toDouble(), toInt(), toString()

Definition at line 977 of file qlocale.h.

Here is the call graph for this function:

◆ toFloat() [2/2]

float QLocale::toFloat ( QStringView  s,
bool *  ok = nullptr 
) const

Returns the float represented by the localized string s.

Returns an infinity if the conversion overflows or 0.0 if the conversion fails for any other reason (e.g. underflow).

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toDouble(), toInt(), toString()
Since
5.10

Definition at line 1940 of file qlocale.cpp.

Here is the call graph for this function:

◆ toInt() [1/2]

int QLocale::toInt ( const QString s,
bool *  ok = nullptr 
) const
inline

Returns the int represented by the localized string s.

If the conversion fails the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toUInt(), toString()

Definition at line 965 of file qlocale.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toInt() [2/2]

int QLocale::toInt ( QStringView  s,
bool *  ok = nullptr 
) const

Returns the int represented by the localized string s.

If the conversion fails, the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toUInt(), toString()
Since
5.10

Definition at line 1818 of file qlocale.cpp.

◆ toLong() [1/2]

long QLocale::toLong ( const QString s,
bool *  ok = nullptr 
) const
inline
Since
5.13

Returns the long int represented by the localized string s.

If the conversion fails the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toInt(), toULong(), toDouble(), toString()

Definition at line 969 of file qlocale.h.

Here is the call graph for this function:

◆ toLong() [2/2]

long QLocale::toLong ( QStringView  s,
bool *  ok = nullptr 
) const
Since
5.13 Returns the long int represented by the localized string s.

If the conversion fails the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toInt(), toULong(), toDouble(), toString()

Definition at line 1857 of file qlocale.cpp.

◆ toLongLong() [1/2]

qlonglong QLocale::toLongLong ( const QString s,
bool *  ok = nullptr 
) const
inline

Returns the long long int represented by the localized string s.

If the conversion fails the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toInt(), toULongLong(), toDouble(), toString()

Definition at line 973 of file qlocale.h.

Here is the call graph for this function:

◆ toLongLong() [2/2]

qlonglong QLocale::toLongLong ( QStringView  s,
bool *  ok = nullptr 
) const

Returns the long long int represented by the localized string s.

If the conversion fails, the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toInt(), toULongLong(), toDouble(), toString()
Since
5.10

Definition at line 1898 of file qlocale.cpp.

◆ toLower()

QString QLocale::toLower ( const QString str) const
Since
4.8

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.

See also
QString::toLower()

Definition at line 3264 of file qlocale.cpp.

Here is the call graph for this function:

◆ toShort() [1/2]

short QLocale::toShort ( const QString s,
bool *  ok = nullptr 
) const
inline

Returns the short int represented by the localized string s.

If the conversion fails the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toUShort(), toString()

Definition at line 961 of file qlocale.h.

Here is the call graph for this function:

◆ toShort() [2/2]

short QLocale::toShort ( QStringView  s,
bool *  ok = nullptr 
) const

Returns the short int represented by the localized string s.

If the conversion fails, the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toUShort(), toString()
Since
5.10

Definition at line 1778 of file qlocale.cpp.

◆ toString() [1/23]

QString QLocale::toString ( const QDateTime dateTime,
const QString format 
) const
inline
Since
4.4

Returns a localized string representation of the given dateTime according to the specified format. If format is an empty string, an empty string is returned.

See also
QDateTime::toString(), QDate::toString(), QTime::toString()

Definition at line 1010 of file qlocale.h.

◆ toString() [2/23]

QString QLocale::toString ( const QDateTime dateTime,
FormatType  format,
QCalendar  cal 
) const
Since
5.14

Returns a localized string representation of the given dateTime according to the specified format (see dateTimeFormat()), optionally for a specified calendar cal.

Note
Some locales may use formats that limit the range of years they can represent.

Definition at line 2183 of file qlocale.cpp.

Here is the call graph for this function:

◆ toString() [3/23]

QString QLocale::toString ( const QDateTime dateTime,
FormatType  format = LongFormat 
) const
Since
4.4 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2207 of file qlocale.cpp.

Here is the call graph for this function:

◆ toString() [4/23]

QString QLocale::toString ( const QDateTime dateTime,
QStringView  format 
) const
Since
5.10 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2168 of file qlocale.cpp.

Here is the call graph for this function:

◆ toString() [5/23]

QString QLocale::toString ( const QDateTime dateTime,
QStringView  format,
QCalendar  cal 
) const
Since
5.14

Returns a localized string representation of the given dateTime according to the specified format, optionally for a specified calendar cal. If format is an empty string, an empty string is returned.

See also
QDateTime::toString(), QDate::toString(), QTime::toString()

Definition at line 2159 of file qlocale.cpp.

Here is the call graph for this function:

◆ toString() [6/23]

QString QLocale::toString ( double  f,
char  format = 'g',
int  precision = 6 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a string representing the floating-point number f.

The form of the representation is controlled by the format and precision parameters.

The format defaults to {'g'}. It can be any of the following:

\table \header

  • Format
  • Meaning \row
  • 'e'
  • format as [-]9.9e[+|-]999 \row
  • 'E'
  • format as [-]9.9E[+|-]999 \row
  • 'f'
  • format as [-]9.9 \row
  • 'g'
  • use 'e' or 'f' format, whichever is more concise \row
  • 'G'
  • use 'E' or 'f' format, whichever is more concise \endtable

For the 'e', 'E', and 'f' formats, the precision represents the number of digits after the decimal point. For the 'g' and 'G' formats, the precision represents the maximum number of significant digits (trailing zeroes are omitted). The special precision value QLocale::FloatingPointShortest selects the shortest representation that, when read as a number, gets back the original floating-point value. Aside from that, any negative precision is ignored in favor of the default, 6.

For the 'e', 'f' and 'g' formats, positive infinity is represented as "inf", negative infinity as "-inf" and floating-point NaN (not-a-number) values are represented as "nan". For the 'E' and 'G' formats, "INF" and "NAN" are used instead. This does not vary with locale.

See also
toDouble(), numberOptions(), exponential(), decimalPoint(), zeroDigit(), positiveSign(), percent(), toCurrencyString(), formattedDataSize(), QLocale::FloatingPointPrecisionOption

Definition at line 2676 of file qlocale.cpp.

◆ toString() [7/23]

QString QLocale::toString ( float  f,
char  format = 'g',
int  precision = 6 
) const
inline

Definition at line 1003 of file qlocale.h.

◆ toString() [8/23]

QString QLocale::toString ( int  i) const
inline

Definition at line 1000 of file qlocale.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString() [9/23]

QString QLocale::toString ( long  i) const
inline

Definition at line 996 of file qlocale.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString() [10/23]

QString QLocale::toString ( QDate  date,
const QString format 
) const

Returns a localized string representation of the given date in the specified format. If format is an empty string, an empty string is returned.

See also
QDate::toString()

Definition at line 2012 of file qlocale.cpp.

Here is the call graph for this function:

◆ toString() [11/23]

QString QLocale::toString ( QDate  date,
FormatType  format,
QCalendar  cal 
) const
Since
5.14

Returns a localized string representation of the given date according to the specified format (see dateFormat()), optionally for a specified calendar cal.

Note
Some locales may use formats that limit the range of years they can represent.

Definition at line 2075 of file qlocale.cpp.

Here is the call graph for this function:

◆ toString() [12/23]

QString QLocale::toString ( QDate  date,
FormatType  format = LongFormat 
) const
Since
4.5 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2099 of file qlocale.cpp.

Here is the call graph for this function:

◆ toString() [13/23]

QString QLocale::toString ( QDate  date,
QStringView  format 
) const
Since
5.10 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2060 of file qlocale.cpp.

Here is the call graph for this function:

◆ toString() [14/23]

QString QLocale::toString ( QDate  date,
QStringView  format,
QCalendar  cal 
) const
Since
5.14

Returns a localized string representation of the given date in the specified format, optionally for a specified calendar cal. If format is an empty string, an empty string is returned.

See also
QDate::toString()

Definition at line 2051 of file qlocale.cpp.

Here is the call graph for this function:

◆ toString() [15/23]

QString QLocale::toString ( qlonglong  i) const

Returns a localized string representation of i.

See also
toLongLong(), numberOptions(), zeroDigit(), positiveSign()

Definition at line 1981 of file qlocale.cpp.

Here is the caller graph for this function:

◆ toString() [16/23]

QString QLocale::toString ( QTime  time,
const QString format 
) const

Returns a localized string representation of the given time according to the specified format. If format is an empty string, an empty string is returned.

See also
QTime::toString()

Definition at line 2025 of file qlocale.cpp.

Here is the call graph for this function:

◆ toString() [17/23]

QString QLocale::toString ( QTime  time,
FormatType  format = LongFormat 
) const

Returns a localized string representation of the given time in the specified format (see timeFormat()).

Definition at line 2233 of file qlocale.cpp.

Here is the call graph for this function:

◆ toString() [18/23]

QString QLocale::toString ( QTime  time,
QStringView  format 
) const
Since
4.5

Returns a localized string representation of the given time according to the specified format. If format is an empty string, an empty string is returned.

See also
QTime::toString()

Definition at line 2145 of file qlocale.cpp.

Here is the call graph for this function:

◆ toString() [19/23]

QString QLocale::toString ( qulonglong  i) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

See also
toULongLong(), numberOptions(), zeroDigit(), positiveSign()

Definition at line 1995 of file qlocale.cpp.

◆ toString() [20/23]

QString QLocale::toString ( short  i) const
inline

Definition at line 998 of file qlocale.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString() [21/23]

QString QLocale::toString ( uint  i) const
inline

Definition at line 1001 of file qlocale.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString() [22/23]

QString QLocale::toString ( ulong  i) const
inline

Definition at line 997 of file qlocale.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString() [23/23]

QString QLocale::toString ( ushort  i) const
inline

Definition at line 999 of file qlocale.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toUInt() [1/2]

uint QLocale::toUInt ( const QString s,
bool *  ok = nullptr 
) const
inline

Returns the unsigned int represented by the localized string s.

If the conversion fails the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toInt(), toString()

Definition at line 967 of file qlocale.h.

Here is the call graph for this function:

◆ toUInt() [2/2]

uint QLocale::toUInt ( QStringView  s,
bool *  ok = nullptr 
) const

Returns the unsigned int represented by the localized string s.

If the conversion fails, the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toInt(), toString()
Since
5.10

Definition at line 1838 of file qlocale.cpp.

◆ toULong() [1/2]

ulong QLocale::toULong ( const QString s,
bool *  ok = nullptr 
) const
inline
Since
5.13

Returns the unsigned long int represented by the localized string s.

If the conversion fails the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toLong(), toInt(), toDouble(), toString()

Definition at line 971 of file qlocale.h.

Here is the call graph for this function:

◆ toULong() [2/2]

ulong QLocale::toULong ( QStringView  s,
bool *  ok = nullptr 
) const
Since
5.13 Returns the unsigned long int represented by the localized string s.

If the conversion fails the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toLong(), toInt(), toDouble(), toString()

Definition at line 1877 of file qlocale.cpp.

◆ toULongLong() [1/2]

qulonglong QLocale::toULongLong ( const QString s,
bool *  ok = nullptr 
) const
inline

Returns the unsigned long long int represented by the localized string s.

If the conversion fails the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toLongLong(), toInt(), toDouble(), toString()

Definition at line 975 of file qlocale.h.

Here is the call graph for this function:

◆ toULongLong() [2/2]

qulonglong QLocale::toULongLong ( QStringView  s,
bool *  ok = nullptr 
) const

Returns the unsigned long long int represented by the localized string s.

If the conversion fails, the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toLongLong(), toInt(), toDouble(), toString()
Since
5.10

Definition at line 1919 of file qlocale.cpp.

◆ toUpper()

QString QLocale::toUpper ( const QString str) const
Since
4.8

Returns an uppercase copy of str.

If Qt Core is using the ICU libraries, they will be used to perform the transformation according to the rules of the current locale. Otherwise the conversion may be done in a platform-dependent manner, with QString::toUpper() as a generic fallback.

See also
QString::toUpper()

Definition at line 3240 of file qlocale.cpp.

Here is the call graph for this function:

◆ toUShort() [1/2]

ushort QLocale::toUShort ( const QString s,
bool *  ok = nullptr 
) const
inline

Returns the unsigned short int represented by the localized string s.

If the conversion fails the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toShort(), toString()

Definition at line 963 of file qlocale.h.

Here is the call graph for this function:

◆ toUShort() [2/2]

ushort QLocale::toUShort ( QStringView  s,
bool *  ok = nullptr 
) const

Returns the unsigned short int represented by the localized string s.

If the conversion fails, the function returns 0.

If ok is not \nullptr, failure is reported by setting *{ok} to false, and success by setting *{ok} to true.

This function ignores leading and trailing whitespace.

See also
toShort(), toString()
Since
5.10

Definition at line 1798 of file qlocale.cpp.

◆ uiLanguages()

QStringList QLocale::uiLanguages ( ) const
Since
4.8

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 object to the QTranslator::load() function.

The first item in the list is the most preferred one.

See also
QTranslator, bcp47Name()

Definition at line 4430 of file qlocale.cpp.

Here is the caller graph for this function:

◆ weekdays()

QList< Qt::DayOfWeek > QLocale::weekdays ( ) const
Since
4.8

Returns a list of days that are considered weekdays according to the current locale.

Definition at line 3146 of file qlocale.cpp.

◆ zeroDigit()

QString QLocale::zeroDigit ( ) const
Since
4.1

Returns the zero digit character of this locale.

See also
toString()

Definition at line 2585 of file qlocale.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const QLocale lhs,
const QLocale rhs 
)
friend

Definition at line 1164 of file qlocale.h.

◆ operator==

bool operator== ( const QLocale lhs,
const QLocale rhs 
)
friend

Definition at line 1163 of file qlocale.h.

◆ QByteArray

friend class QByteArray
friend

Definition at line 68 of file qlocale.h.

◆ QCalendarBackend

friend class QCalendarBackend
friend

Definition at line 1159 of file qlocale.h.

◆ QDoubleValidatorPrivate

friend class QDoubleValidatorPrivate
friend

Definition at line 70 of file qlocale.h.

◆ QGregorianCalendar

friend class QGregorianCalendar
friend

Definition at line 1160 of file qlocale.h.

◆ qHash() [1/2]

size_t qHash ( const QLocale key,
size_t  seed 
)
related
Since
5.6

Returns the hash value for key, using seed to seed the calculation.

Definition at line 1140 of file qlocale.cpp.

◆ qHash [2/2]

size_t qHash ( const QLocale key,
size_t  seed = 0 
)
friend
Since
5.6

Returns the hash value for key, using seed to seed the calculation.

Definition at line 1140 of file qlocale.cpp.

◆ QIntValidator

friend class QIntValidator
friend

Definition at line 69 of file qlocale.h.

◆ QLocalePrivate

friend class QLocalePrivate
friend

Definition at line 1157 of file qlocale.h.

◆ QString

friend class QString
friend

Definition at line 67 of file qlocale.h.

◆ QSystemLocale

friend class QSystemLocale
friend

Definition at line 1158 of file qlocale.h.

◆ QTextStream

friend class QTextStream
friend

Definition at line 71 of file qlocale.h.

◆ QTextStreamPrivate

friend class QTextStreamPrivate
friend

Definition at line 72 of file qlocale.h.


The documentation for this class was generated from the following files: