Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QLocale Class Reference

#include <qlocale.h>

+ Inheritance diagram for QLocale:
+ Collaboration diagram for QLocale:

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 , Haryanvi = 330 , NorthernFrisian = 331 ,
  Rajasthani = 332 , Moksha = 333 , TokiPona = 334 , Pijin = 335 ,
  Obolo = 336 , Baluchi = 337 , Ligurian = 338 , Rohingya = 339 ,
  Torwali = 340 , Anii = 341 , Kangri = 342 , Venetian = 343 ,
  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 = Venetian
}
 
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 , HanifiScript = 142 , BengaliScript = BanglaScript ,
  MendeKikakuiScript = MendeScript , OriyaScript = OdiaScript , SimplifiedChineseScript = SimplifiedHanScript , TraditionalChineseScript = TraditionalHanScript ,
  LastScript = HanifiScript
}
 
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 class  TagSeparator : char { Dash = '-' , Underscore = '_' }
 
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 ()
 Constructs a QLocale object initialized with the default locale.
 
 QLocale (const QString &name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
 QLocale (QStringView name)
 \variable QLocale::DefaultTwoDigitBaseYear
 
 QLocale (Language language, Territory territory)
 Constructs a QLocale object for the specified language and territory.
 
 QLocale (Language language, Script script=AnyScript, Territory territory=AnyTerritory)
 
 QLocale (const QLocale &other) noexcept
 Constructs a QLocale object as a copy of other.
 
QLocaleoperator= (const QLocale &other) noexcept
 Assigns other to this QLocale object and returns a reference to this QLocale object.
 
 ~QLocale ()
 Destructor.
 
void swap (QLocale &other) noexcept
 
Language language () const
 Returns the language of this locale.
 
Script script () const
 
Territory territory () const
 
QString name (TagSeparator separator=TagSeparator::Underscore) const
 The short name of this locale.
 
QString bcp47Name (TagSeparator separator=TagSeparator::Dash) const
 Returns the BCP47 field names joined with dashes.
 
QString nativeLanguageName () const
 
QString nativeTerritoryName () const
 
short toShort (const QString &s, bool *ok=nullptr) const
 Returns the short int represented by the localized string s.
 
ushort toUShort (const QString &s, bool *ok=nullptr) const
 Returns the unsigned short int represented by the localized string s.
 
int toInt (const QString &s, bool *ok=nullptr) const
 Returns the int represented by the localized string s.
 
uint toUInt (const QString &s, bool *ok=nullptr) const
 Returns the unsigned int represented by the localized string s.
 
long toLong (const QString &s, bool *ok=nullptr) const
 
ulong toULong (const QString &s, bool *ok=nullptr) const
 
qlonglong toLongLong (const QString &s, bool *ok=nullptr) const
 Returns the long long int represented by the localized string s.
 
qulonglong toULongLong (const QString &s, bool *ok=nullptr) const
 Returns the unsigned long long int represented by the localized string s.
 
float toFloat (const QString &s, bool *ok=nullptr) const
 Returns the float represented by the localized string s.
 
double toDouble (const QString &s, bool *ok=nullptr) const
 Returns the double represented by the localized string s.
 
short toShort (QStringView s, bool *ok=nullptr) const
 Returns the short int represented by the localized string s.
 
ushort toUShort (QStringView s, bool *ok=nullptr) const
 Returns the unsigned short int represented by the localized string s.
 
int toInt (QStringView s, bool *ok=nullptr) const
 Returns the int represented by the localized string s.
 
uint toUInt (QStringView s, bool *ok=nullptr) const
 Returns the unsigned int represented by the localized string s.
 
long toLong (QStringView s, bool *ok=nullptr) const
 
ulong toULong (QStringView s, bool *ok=nullptr) const
 
qlonglong toLongLong (QStringView s, bool *ok=nullptr) const
 Returns the long long int represented by the localized string s.
 
qulonglong toULongLong (QStringView s, bool *ok=nullptr) const
 Returns the unsigned long long int represented by the localized string s.
 
float toFloat (QStringView s, bool *ok=nullptr) const
 Returns the float represented by the localized string s.
 
double toDouble (QStringView s, bool *ok=nullptr) const
 Returns the double represented by the localized string s.
 
QString toString (qlonglong i) const
 Returns a localized string representation of i.
 
QString toString (qulonglong i) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QString toString (long i) const
 
QString toString (ulong i) const
 
QString toString (short i) const
 
QString toString (ushort i) const
 
QString toString (int i) const
 
QString toString (uint i) const
 
QString toString (double f, char format='g', int precision=6) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a string representing the floating-point number f.
 
QString toString (float f, char format='g', int precision=6) const
 
QString toString (QDate date, const QString &format) const
 Returns a localized string representation of the given date in the specified format.
 
QString toString (QTime time, const QString &format) const
 Returns a localized string representation of the given time according to the specified format.
 
QString toString (const QDateTime &dateTime, const QString &format) const
 
QString toString (QDate date, QStringView format) const
 
QString toString (QTime time, QStringView format) const
 
QString toString (const QDateTime &dateTime, QStringView format) const
 
QString toString (QDate date, FormatType format=LongFormat) const
 
QString toString (QTime time, FormatType format=LongFormat) const
 Returns a localized string representation of the given time in the specified format (see timeFormat()).
 
QString toString (const QDateTime &dateTime, FormatType format=LongFormat) const
 
QString toString (QDate date, QStringView format, QCalendar cal) const
 
QString toString (QDate date, FormatType format, QCalendar cal) const
 
QString toString (const QDateTime &dateTime, FormatType format, QCalendar cal) const
 
QString toString (const QDateTime &dateTime, QStringView format, QCalendar cal) const
 
QString dateFormat (FormatType format=LongFormat) const
 
QString timeFormat (FormatType format=LongFormat) const
 
QString dateTimeFormat (FormatType format=LongFormat) const
 
QString decimalPoint () const
 
QString groupSeparator () const
 
QString percent () const
 
QString zeroDigit () const
 
QString negativeSign () const
 
QString positiveSign () const
 
QString exponential () const
 
QString monthName (int, FormatType format=LongFormat) const
 
QString standaloneMonthName (int, FormatType format=LongFormat) const
 
QString dayName (int, FormatType format=LongFormat) const
 
QString standaloneDayName (int, FormatType format=LongFormat) const
 
Qt::DayOfWeek firstDayOfWeek () const
 
QList< Qt::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 (TagSeparator separator=TagSeparator::Dash) const
 List of locale names for use in selecting translations.
 
void setNumberOptions (NumberOptions options)
 
NumberOptions numberOptions () const
 
QString quoteString (const QString &str, QuotationStyle style=StandardQuotation) const
 
QString quoteString (QStringView str, QuotationStyle style=StandardQuotation) const
 
QString createSeparatedList (const QStringList &strl) const
 

Static Public Member Functions

static QString languageToCode (Language language, LanguageCodeTypes codeTypes=AnyLanguageCode)
 Returns the two- or three-letter language code for language, as defined in the ISO 639 standards.
 
static Language codeToLanguage (QStringView languageCode, LanguageCodeTypes codeTypes=AnyLanguageCode) noexcept
 Returns the QLocale::Language enum corresponding to the two- or three-letter languageCode, as defined in the ISO 639 standards.
 
static QString territoryToCode (Territory territory)
 
static Territory codeToTerritory (QStringView territoryCode) noexcept
 
static QString scriptToCode (Script script)
 Returns the four-letter script code for script, as defined in the ISO 15924 standard.
 
static Script codeToScript (QStringView scriptCode) noexcept
 Returns the QLocale::Script enum corresponding to the four-letter script scriptCode, as defined in the ISO 15924 standard.
 
static QString languageToString (Language language)
 Returns a QString containing the name of language.
 
static QString territoryToString (Territory territory)
 
static QString scriptToString (Script script)
 
static void setDefault (const QLocale &locale)
 \nonreentrant
 
static QLocale c ()
 Returns a QLocale object initialized to the "C" locale.
 
static QLocale system ()
 Returns a QLocale object initialized to the system locale.
 
static QList< QLocalematchingLocales (QLocale::Language language, QLocale::Script script, QLocale::Territory territory)
 Returns a list of valid locale objects that match the given language, script and territory.
 

Static Public Attributes

static constexpr int DefaultTwoDigitBaseYear = 1900
 

Friends

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

Related Symbols

(Note that these are not member symbols.)

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

Detailed Description

Definition at line 28 of file qlocale.h.

Member Typedef Documentation

◆ Territory

Definition at line 861 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 567 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 896 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 903 of file qlocale.h.

◆ FloatingPointPrecisionOption

Enumerator
FloatingPointShortest 

Definition at line 889 of file qlocale.h.

◆ FormatType

Enumerator
LongFormat 
ShortFormat 
NarrowFormat 

Definition at line 875 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 
Haryanvi 
NorthernFrisian 
Rajasthani 
Moksha 
TokiPona 
Pijin 
Obolo 
Baluchi 
Ligurian 
Rohingya 
Torwali 
Anii 
Kangri 
Venetian 
Afan 
Bengali 
Bhutani 
Byelorussian 
Cambodian 
CentralMoroccoTamazight 
Chewa 
Frisian 
Greenlandic 
Inupiak 
Kirghiz 
Kurundi 
Kwanyama 
Navaho 
Oriya 
RhaetoRomance 
Uighur 
Uigur 
Walamo 
LastLanguage 

Definition at line 43 of file qlocale.h.

◆ LanguageCodeType

Enumerator
ISO639Part1 
ISO639Part2B 
ISO639Part2T 
ISO639Part3 
LegacyLanguageCode 
ISO639Part2 
ISO639Alpha2 
ISO639Alpha3 
ISO639 
AnyLanguageCode 

Definition at line 1102 of file qlocale.h.

◆ MeasurementSystem

Enumerator
MetricSystem 
ImperialUSSystem 
ImperialUKSystem 
ImperialSystem 

Definition at line 867 of file qlocale.h.

◆ NumberOption

Enumerator
DefaultNumberOptions 
OmitGroupSeparator 
RejectGroupSeparator 
OmitLeadingZeroInExponent 
RejectLeadingZeroInExponent 
IncludeTrailingZeroesAfterDot 
RejectTrailingZeroesAfterDot 

Definition at line 877 of file qlocale.h.

◆ QuotationStyle

Enumerator
StandardQuotation 
AlternateQuotation 

Definition at line 1159 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 
HanifiScript 
BengaliScript 
MendeKikakuiScript 
OriyaScript 
SimplifiedChineseScript 
TraditionalChineseScript 
LastScript 

Definition at line 412 of file qlocale.h.

◆ TagSeparator

enum class QLocale::TagSeparator : char
strong
Since
6.7

Indicate how to combine the parts that make up a locale identifier.

A locale identifier may be made up of several tags, indicating language, script and territory (plus, potentially, other details), joined together to form the identifier. Various standards and conventional forms use either a dash (the Unicode HYPHEN-MINUS, U+002D) or an underscore (LOW LINE, U+005F). Different clients of QLocale may thus need one or the other.

\value Dash Use {'-'}, the dash or hyphen character. \value Underscore Use {'_'}, the underscore character.

Note
Although dash and underscore are the only separators used in public standards (as at 2023), it is possible to cast any \l {https://en.cppreference.com/w/cpp/language/ascii} {ASCII} character to this type if a non-standard ASCII separator is needed. Casting a non-ASCII character (with decimal value above 127) is not supported: such values are reserved for future use as enum members if some public standard ever uses a non-ASCII separator. It is, of course, possible to use QString::replace() to replace the separator used by a function taking a parameter of this type with an arbitrary Unicode character or string.
Enumerator
Dash 
Underscore 

Definition at line 893 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 1070 of file qlocale.cpp.

References systemData().

Referenced by matchingLocales(), and system().

+ Here is the call graph for this function:
+ 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.

◆ QLocale() [3/6]

QLocale::QLocale ( QStringView name)
explicit

\variable QLocale::DefaultTwoDigitBaseYear

Since
6.7

The default start year of the century within which a format taking a two-digit year will select. The value of the constant is {1900}.

Some locales use, particularly for ShortFormat, only the last two digits of the year. Proir to 6.7 the year 1900 was always used as a base year for such cases. Now various QLocale and QDate functions have the overloads that allow callers to specify the base year, and this constant is used as its default value.

See also
toDate(), toDateTime(), QDate::fromString(), QDateTime::fromString()
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 1051 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 1089 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 1113 of file qlocale.cpp.

◆ QLocale() [6/6]

QLocale::QLocale ( const QLocale & other)
defaultnoexcept

Constructs a QLocale object as a copy of other.

◆ ~QLocale()

QLocale::~QLocale ( )

Destructor.

Definition at line 1128 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 3439 of file qlocale.cpp.

References am_data, QSystemLocale::AMText, QLocalePrivate::m_data, systemLocale(), and systemLocaleData.

Referenced by QAndroidSystemLocale::query().

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

◆ bcp47Name()

QString QLocale::bcp47Name ( TagSeparator separator = TagSeparator::Dash) const

Returns the BCP47 field names joined with dashes.

Since
4.8

This combines as many of language, script and territory (and possibly other BCP47 fields) for this locale as are needed to uniquely specify it. Note that fields may be omitted if the Unicode consortium's \l {Matching combinations of language, script and territory}{Likely Subtag Rules} imply the omitted fields when given those retained. See \l name() for how to construct a string from individual fields, if some other format is needed.

Unlike uiLanguages(), the value returned by bcp47Name() represents the locale name of the QLocale data; this need not be the language the user-interface should be in.

This function tries to conform the locale name to the IETF Best Common Practice 47, defined by RFC 5646. Since Qt 6.7, it supports an optional separator parameter which can be used to override the BCP47-specified use of a hyphen to separate the tags. For use in IETF-defined protocols, however, the default, QLocale::TagSeparator::Dash, should be retained.

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

Definition at line 1482 of file qlocale.cpp.

References badSeparatorWarning(), QLocalePrivate::bcp47Name(), QString::fromLatin1(), and sep.

Referenced by QQmlApplicationEnginePrivate::QQmlApplicationEnginePrivate().

+ Here is the call graph for this function:
+ Here is the caller 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 1146 of file qlocale.h.

Referenced by QTimeZonePrivate::abbreviation(), QPSQLDriver::formatValue(), QNetworkHeadersPrivate::fromHttpDate(), QTextStreamPrivate::getNumber(), QTextStreamPrivate::getReal(), QInputMethod::locale(), QTextStreamPrivate::putNumber(), QNetworkHeadersPrivate::toHttpDate(), and QNetworkCookie::toRawForm().

+ 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 1530 of file qlocale.cpp.

References QLocalePrivate::codeToLanguage().

Referenced by QFFmpegMetaData::addEntry(), QT_BEGIN_NAMESPACE::addTagToMetaData(), AVFMetaData::fromAssetTrack(), and getLocaleLanguage().

+ Here is the call graph for this function:
+ Here is the caller 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 1621 of file qlocale.cpp.

References QLocalePrivate::codeToScript().

+ 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 1561 of file qlocale.cpp.

References QLocalePrivate::codeToTerritory().

+ 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 4862 of file qlocale.cpp.

References QSystemLocale::Collation, d, systemLocale(), and systemLocaleData.

+ Here is the call graph for this function:

◆ 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 1246 of file qlocale.cpp.

References QStringView::arg(), QString::arg(), QList< T >::at(), QVariant::fromValue(), i, list, list_pattern_part_data, QSystemLocale::ListToSeparatedString, QLocalePrivate::m_data, QString, QList< T >::size(), systemLocale(), and systemLocaleData.

Referenced by QAndroidSystemLocale::query().

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

◆ currencySymbol()

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

Definition at line 4548 of file qlocale.cpp.

References currency_display_name_data, currency_symbol_data, QSystemLocale::CurrencySymbol, d, QString::fromLatin1(), qstrnlen(), systemLocale(), and systemLocaleData.

Referenced by QAndroidSystemLocale::query().

+ Here is the call graph for this function:
+ 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 2334 of file qlocale.cpp.

References date_format_data, QSystemLocale::DateFormatLong, QSystemLocale::DateFormatShort, getData(), LongFormat, QLocalePrivate::m_data, systemLocale(), and systemLocaleData.

Referenced by dateTimeFormat(), QAndroidSystemLocale::query(), QDateTimeEditPrivate::readLocaleSettings(), toString(), and toString().

+ Here is the call graph for this function:
+ 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 2396 of file qlocale.cpp.

References dateFormat(), QSystemLocale::DateTimeFormatLong, QSystemLocale::DateTimeFormatShort, LongFormat, QLocalePrivate::m_data, systemLocale(), systemLocaleData, and timeFormat().

Referenced by QAndroidSystemLocale::query(), QDateTimeEditPrivate::readLocaleSettings(), toString(), and toString().

+ Here is the call graph for this function:
+ 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 2997 of file qlocale.cpp.

References QCalendar::weekDayName().

Referenced by QAndroidSystemLocale::query(), and QtPrivate::QCalendarDayValidator::text().

+ 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 fractional part separator for this locale.

This is the token that separates the whole number part from the fracional part in the representation of a number which has a fractional part. This is commonly called the "decimal point character" - even though, in many locales, it is not a "point" (or similar dot). It is (since Qt 6.0) returned as a string in case some locale needs more than one UTF-16 code-point to represent its separator.

See also
groupSeparator(), toString()

Definition at line 2655 of file qlocale.cpp.

References QLocaleData::decimalPoint(), and QLocalePrivate::m_data.

Referenced by QTextStreamPrivate::getReal(), QAndroidSystemLocale::query(), and QDoubleSpinBoxPrivate::validateAndInterpret().

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

◆ exponential()

QString QLocale::exponential ( ) const
Since
4.1

Returns the exponent separator for this locale.

This is a token used to separate mantissa from exponent in some floating-point numeric representations. It is (since Qt 6.0) returned as a string because, in some locales, it is not a single character - for example, it may consist of a multiplication sign and a representation of the "ten to the power" operator.

See also
toString(double, char, int)

Definition at line 2762 of file qlocale.cpp.

References QLocaleData::exponentSeparator(), and QLocalePrivate::m_data.

Referenced by QTextStreamPrivate::getReal().

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

◆ firstDayOfWeek()

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

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

Definition at line 3272 of file qlocale.cpp.

References QSystemLocale::FirstDayOfWeek, QLocalePrivate::m_data, QLocaleData::m_first_day_of_week, systemLocale(), and systemLocaleData.

Referenced by QQuickWeekNumberModelPrivate::init(), QQuickMonthModelPrivate::populate(), and QAndroidSystemLocale::query().

+ Here is the call graph for this function:
+ 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 4695 of file qlocale.cpp.

References base, byte_unit_data, d, number, Q_ASSERT, qAbs(), qCountLeadingZeroBits(), qMin(), and toString().

+ Here is the call graph for this function:

◆ groupSeparator()

QString QLocale::groupSeparator ( ) const
Since
4.1

Returns the digit-grouping separator for this locale.

This is a token used to break up long sequences of digits, in the representation of a number, to make it easier to read. In some locales it may be empty, indicating that digits should not be broken up into groups in this way. In others it may be a spacing character. It is (since Qt 6.0) returned as a string in case some locale needs more than one UTF-16 code-point to represent its separator.

See also
decimalPoint(), toString()

Definition at line 2674 of file qlocale.cpp.

References QLocaleData::groupSeparator(), and QLocalePrivate::m_data.

Referenced by QTextStreamPrivate::getNumber(), QTextStreamPrivate::getReal(), QAndroidSystemLocale::query(), QSpinBoxPrivate::validateAndInterpret(), and QDoubleSpinBoxPrivate::validateAndInterpret().

+ Here is the call graph for this function:
+ 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 1317 of file qlocale.cpp.

References QLocalePrivate::languageId().

Referenced by QWindowsInputContext::endComposition(), QCollatorPrivate::isC(), matchingLocales(), name(), and operator<<().

+ 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 1510 of file qlocale.cpp.

References QString::data(), and QLocalePrivate::languageToCode().

Referenced by applyMetaDataToTagSetter(), setAVMetadataItemForKey(), and QFFmpegMetaData::value().

+ Here is the call graph for this function:
+ Here is the caller 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 1632 of file qlocale.cpp.

References QString::fromUtf8(), language_name_index, language_name_list, and LastLanguage.

Referenced by operator<<(), and QMediaMetaData::stringValue().

+ Here is the call graph for this function:
+ 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 2893 of file qlocale.cpp.

References QLocale(), C, c_private(), language(), locale_data, locale_data_size, locale_index, QLocalePrivate, script(), system(), systemData(), and territory().

+ Here is the call graph for this function:

◆ measurementSystem()

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

Returns the measurement system for the locale.

Definition at line 3326 of file qlocale.cpp.

References QLocalePrivate::m_data, QSystemLocale::MeasurementSystem, QLocalePrivate::measurementSystem(), systemLocale(), and systemLocaleData.

Referenced by QDeclarativeGeoRouteModel::measurementSystem(), and QGeoRoutingManagerEngine::setLocale().

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

◆ 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 2963 of file qlocale.cpp.

References QCalendar::monthName(), and QCalendar::Unspecified.

Referenced by QAndroidSystemLocale::query().

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

◆ name()

QString QLocale::name ( TagSeparator separator = TagSeparator::Underscore) const

The short name of this locale.

Returns the language and territory of this locale as a string of the form "language_territory", where language is a lowercase, two-letter ISO 639 language code, and territory is an uppercase, two- or three-letter ISO 3166 territory code. If the locale has no specified territory, only the language name is returned. Since Qt 6.7 an optional separator parameter can be supplied to override the default underscore character separating the two tags.

Even if the QLocale object was constructed with an explicit script, name() will not contain it for compatibility reasons. Use \l bcp47Name() instead if you need a full locale name, or construct the string you want to identify a locale by from those returned by passing its \l language() to \l languageToCode() and similar for the script and territory.

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

Definition at line 1412 of file qlocale.cpp.

References AnyTerritory, badSeparatorWarning(), C, QString::data(), language(), QLocalePrivate::languageCode(), sep, territory(), QLocalePrivate::territoryCode(), and view.

Referenced by operator<<(), and QFileSelectorPrivate::updateSelectors().

+ 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 "Schweizer Hochdeutsch" for the Swiss-German locale.

See also
nativeTerritoryName(), languageToString()

Definition at line 4882 of file qlocale.cpp.

References d, endonyms_data, QSystemLocale::NativeLanguageName, systemLocale(), and systemLocaleData.

+ Here is the call graph for this function:

◆ 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 4902 of file qlocale.cpp.

References d, endonyms_data, QSystemLocale::NativeTerritoryName, systemLocale(), and systemLocaleData.

+ Here is the call graph for this function:

◆ negativeSign()

QString QLocale::negativeSign ( ) const
Since
4.1

Returns the negative sign indicator of this locale.

This is a token presumed to be used as a prefix to a number to indicate that it is negative. It is (since Qt 6.0) returned as a string because, in some locales, it is not a single character - for example, because it includes a text-direction-control character.

See also
positiveSign(), toString()

Definition at line 2727 of file qlocale.cpp.

References QLocalePrivate::m_data, and QLocaleData::negativeSign().

Referenced by QTextStreamPrivate::getNumber(), QTextStreamPrivate::getReal(), QTextStreamPrivate::putNumber(), QTextStreamPrivate::putString(), QTextStreamPrivate::putString(), and QAndroidSystemLocale::query().

+ Here is the call graph for this function:
+ 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 1193 of file qlocale.cpp.

References QLocalePrivate::m_numberOptions.

Referenced by QDoubleValidatorPrivate::fixupWithLocale(), QTextStreamPrivate::putNumber(), QProgressBar::text(), and QDoubleValidatorPrivate::validateWithLocale().

+ Here is the caller graph for this function:

◆ operator=()

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

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

◆ percent()

QString QLocale::percent ( ) const
Since
4.1

Returns the percent marker of this locale.

This is a token presumed to be appended to a number to indicate a percentage. It is (since Qt 6.0) returned as a string because, in some locales, it is not a single character - for example, because it includes a text-direction-control character.

See also
toString()

Definition at line 2691 of file qlocale.cpp.

References QLocalePrivate::m_data, and QLocaleData::percentSign().

Referenced by QProgressBarPrivate::initDefaultFormat().

+ Here is the call graph for this function:
+ 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 3459 of file qlocale.cpp.

References QLocalePrivate::m_data, pm_data, QSystemLocale::PMText, systemLocale(), and systemLocaleData.

Referenced by QAndroidSystemLocale::query().

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

◆ positiveSign()

QString QLocale::positiveSign ( ) const
Since
4.5

Returns the positive sign indicator of this locale.

This is a token presumed to be used as a prefix to a number to indicate that it is positive. It is (since Qt 6.0) returned as a string because, in some locales, it is not a single character - for example, because it includes a text-direction-control character.

See also
negativeSign(), toString()

Definition at line 2744 of file qlocale.cpp.

References QLocalePrivate::m_data, and QLocaleData::positiveSign().

Referenced by QTextStreamPrivate::getNumber(), QTextStreamPrivate::getReal(), QTextStreamPrivate::putString(), QTextStreamPrivate::putString(), and QAndroidSystemLocale::query().

+ Here is the call graph for this function:
+ 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 1161 of file qlocale.h.

References str.

Referenced by QAndroidSystemLocale::query().

+ 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 1212 of file qlocale.cpp.

References AlternateQuotation, QVariant::fromValue(), QLocalePrivate::m_data, single_character_data, StandardQuotation, str, QSystemLocale::StringToAlternateQuotation, QSystemLocale::StringToStandardQuotation, systemLocale(), and systemLocaleData.

+ Here is the call graph for this function:

◆ 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 1329 of file qlocale.cpp.

References QLocalePrivate::m_data.

Referenced by matchingLocales(), operator<<(), scriptToCode(), scriptToString(), textDirection(), and writingSystemFromLocale().

+ 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 1607 of file qlocale.cpp.

References script(), and QLocalePrivate::scriptToCode().

+ Here is the call graph for this function:

◆ scriptToString()

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

Returns a QString containing the name of script.

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

Definition at line 1674 of file qlocale.cpp.

References QString::fromUtf8(), LastScript, script(), script_name_index, and script_name_list.

Referenced by operator<<().

+ 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 1295 of file qlocale.cpp.

References default_data, Q_ASSERT, and QLocalePrivate::s_generation.

Referenced by Widget::argFunction().

+ 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 1177 of file qlocale.cpp.

References QLocalePrivate::m_numberOptions.

Referenced by QProgressBar::text().

+ 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 3014 of file qlocale.cpp.

References QCalendar::standaloneWeekDayName().

Referenced by QAndroidSystemLocale::query().

+ 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 2979 of file qlocale.cpp.

References QCalendar::standaloneMonthName(), and QCalendar::Unspecified.

Referenced by QQuickMonthModelPrivate::populate(), and QAndroidSystemLocale::query().

+ 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 927 of file qlocale.h.

References d, other(), and swap().

Referenced by swap().

+ Here is the call graph for this function:
+ Here is the caller 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 2862 of file qlocale.cpp.

References QLocale(), DefaultNumberOptions, locale_data, locale_data_size, Q_ASSERT, systemData(), and systemLocaleData.

Referenced by QDateTimeParser::QDateTimeParser(), addFontToDatabase(), QCalendarBackend::dateTimeToString(), QAndroidPlatformFontDatabase::fallbacksForFamily(), MainWindow::insertCalendar(), QPlatformInputContext::locale(), makeAcceptLanguage(), matchingLocales(), printLocalizationInformation(), QFileSystemModelPrivate::size(), QFileSystemModelPrivate::time(), QGeoRouteParserOsrmV5ExtensionMapbox::updateQuery(), and writingSystemFromLocale().

+ Here is the call graph for this function:
+ 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 1341 of file qlocale.cpp.

References QLocalePrivate::territoryId().

Referenced by matchingLocales(), name(), operator<<(), territoryToCode(), and territoryToString().

+ 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 1546 of file qlocale.cpp.

References territory(), and QLocalePrivate::territoryToCode().

+ Here is the call graph for this function:

◆ territoryToString()

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

Returns a QString containing the name of territory.

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

Definition at line 1646 of file qlocale.cpp.

References QString::fromUtf8(), LastTerritory, territory(), territory_name_index, and territory_name_list.

Referenced by operator<<().

+ 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 3344 of file qlocale.cpp.

References AdlamScript, ArabicScript, AvestanScript, CypriotScript, HatranScript, HebrewScript, ImperialAramaicScript, InscriptionalPahlaviScript, InscriptionalParthianScript, KharoshthiScript, Qt::LeftToRight, LydianScript, MandaeanScript, ManichaeanScript, MendeKikakuiScript, MeroiticCursiveScript, MeroiticScript, NabataeanScript, NkoScript, OldHungarianScript, OldNorthArabianScript, OldSouthArabianScript, OrkhonScript, PalmyreneScript, PhoenicianScript, PsalterPahlaviScript, Qt::RightToLeft, SamaritanScript, script(), SyriacScript, and ThaanaScript.

Referenced by QDBusMenuAdaptor::textDirection().

+ 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 2365 of file qlocale.cpp.

References getData(), LongFormat, QLocalePrivate::m_data, systemLocale(), systemLocaleData, time_format_data, QSystemLocale::TimeFormatLong, and QSystemLocale::TimeFormatShort.

Referenced by dateTimeFormat(), QAndroidSystemLocale::query(), QDateTimeEditPrivate::readLocaleSettings(), and toString().

+ Here is the call graph for this function:
+ 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 4635 of file qlocale.cpp.

References arg, currency_format_data, QSystemLocale::CurrencyToString, d, QVariant::fromValue(), QString::isNull(), str, systemLocale(), systemLocaleData, and toString().

+ Here is the call graph for this function:

◆ toCurrencyString() [2/8]

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

Definition at line 1092 of file qlocale.h.

References i.

◆ toCurrencyString() [3/8]

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

Definition at line 1087 of file qlocale.h.

References i.

◆ 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 4580 of file qlocale.cpp.

References arg, currency_format_data, QSystemLocale::CurrencyToString, d, QVariant::fromValue(), QString::isEmpty(), QString::isNull(), str, systemLocale(), systemLocaleData, and toString().

Referenced by QAndroidSystemLocale::query().

+ Here is the call graph for this function:
+ 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 4607 of file qlocale.cpp.

References arg, currency_format_data, QSystemLocale::CurrencyToString, d, QVariant::fromValue(), QString::isEmpty(), QString::isNull(), str, systemLocale(), systemLocaleData, and toString().

+ Here is the call graph for this function:

◆ toCurrencyString() [6/8]

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

Definition at line 1083 of file qlocale.h.

References i.

◆ toCurrencyString() [7/8]

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

Definition at line 1089 of file qlocale.h.

References i.

◆ toCurrencyString() [8/8]

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

Definition at line 1085 of file qlocale.h.

References i.

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

bool ok;
double d;
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
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.

This function ignores leading and trailing whitespace.

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

Definition at line 969 of file qlocale.h.

References ok, qToStringViewIgnoringNull(), and toDouble().

Referenced by QTextStreamPrivate::getReal(), toFloat(), QDoubleSpinBoxPrivate::validateAndInterpret(), and QDoubleValidatorPrivate::validateWithLocale().

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

bool ok;
double d;
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
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
double toDouble(const QString &s, bool *ok=nullptr) const
Returns the double represented by the localized string s.
Definition qlocale.h:969
static void setDefault(const QLocale &locale)
\nonreentrant
Definition qlocale.cpp:1295
@ Egypt
Definition qlocale.h:639
int toInt(const QString &s, bool *ok=nullptr) const
Returns the int represented by the localized string s.
Definition qlocale.h:955
QString toString(qlonglong i) const
Returns a localized string representation of i.
Definition qlocale.cpp:2052
@ Arabic
Definition qlocale.h:58
@ German
Definition qlocale.h:138
@ English
Definition qlocale.h:119
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
Definition qstring.cpp:8870
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
QLocale egyptian(QLocale::Arabic, QLocale::Egypt)
[0]
QLocale cLocale
QLocale swiss("de_CH")
QLocale german
QLocale c(QLocale::C)
QLocale korean("ko")
[1]

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 2041 of file qlocale.cpp.

References QLocalePrivate::m_data, QLocalePrivate::m_numberOptions, ok, and QLocaleData::stringToDouble().

+ Here is the call graph for this function:

◆ 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 ignores leading and trailing whitespace.

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

Definition at line 967 of file qlocale.h.

References ok, and qToStringViewIgnoringNull().

+ 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 2015 of file qlocale.cpp.

References QLocaleData::convertDoubleToFloat(), ok, and toDouble().

+ 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 955 of file qlocale.h.

References ok, qToStringViewIgnoringNull(), and toInt().

Referenced by QQuickSpinBoxPrivate::evaluateValueFromText(), QIntValidator::validate(), and QSpinBoxPrivate::validateAndInterpret().

+ 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 1893 of file qlocale.cpp.

References ok.

◆ 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 959 of file qlocale.h.

References ok, and qToStringViewIgnoringNull().

+ 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 1932 of file qlocale.cpp.

References ok.

◆ 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 963 of file qlocale.h.

References ok, and qToStringViewIgnoringNull().

+ 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 1973 of file qlocale.cpp.

References ok.

◆ 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 3418 of file qlocale.cpp.

References QLocalePrivate::bcp47Name(), ok, str, and QString::toLower().

+ 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 951 of file qlocale.h.

References ok, and qToStringViewIgnoringNull().

+ 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 1853 of file qlocale.cpp.

References ok.

◆ 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 998 of file qlocale.h.

References dateTime, qToStringViewIgnoringNull(), and toString().

+ Here is the call graph for this function:

◆ 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 2252 of file qlocale.cpp.

References dateTime, dateTimeFormat(), QSystemLocale::DateTimeToStringLong, QSystemLocale::DateTimeToStringShort, QDateTime::isValid(), LongFormat, QLocalePrivate::m_data, QString, systemLocale(), systemLocaleData, and toString().

+ 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 2276 of file qlocale.cpp.

References dateTime, dateTimeFormat(), QSystemLocale::DateTimeToStringLong, QSystemLocale::DateTimeToStringShort, QDateTime::isValid(), LongFormat, QLocalePrivate::m_data, QString, systemLocale(), systemLocaleData, and toString().

+ 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 2237 of file qlocale.cpp.

References dateTime, and QCalendar::dateTimeToString().

+ 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 2228 of file qlocale.cpp.

References dateTime.

◆ 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
  • Meaning of precision \row
  • 'e'
  • format as [-]9.9e[+|-]999
  • number of digits after the decimal point \row
  • 'E'
  • format as [-]9.9E[+|-]999
  • " \row \li \c 'f' \li format as [-]9.9 \li " \row
  • 'F'
  • same as 'f' except for INF and NAN (see below)
  • " \row \li \c 'g' \li use \c 'e' or \c 'f' format, whichever is more concise \li maximum number of significant digits (trailing zeroes are omitted) \row \li \c 'G' \li use \c 'E' or \c 'F' format, whichever is more concise \li " \endtable

The special precision value QLocale::FloatingPointShortest selects the shortest representation that, when read as a number, gets back the original floating-point value. Aside from that, any negative precision is ignored in favor of the default, 6.

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

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

Definition at line 2801 of file qlocale.cpp.

References QLocaleData::AddTrailingZeroes, QLocaleData::CapitalEorX, QLocaleData::DFDecimal, QLocaleData::DFExponent, QLocaleData::DFSignificantDigits, QLocaleData::doubleToString(), form, QLocaleData::GroupDigits, IncludeTrailingZeroesAfterDot, QtMiscUtils::isAsciiUpper(), QLocalePrivate::m_data, QLocalePrivate::m_numberOptions, OmitGroupSeparator, OmitLeadingZeroInExponent, QtMiscUtils::toAsciiLower(), and QLocaleData::ZeroPadExponent.

+ Here is the call graph for this function:

◆ toString() [7/23]

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

Definition at line 992 of file qlocale.h.

References toString().

+ Here is the call graph for this function:

◆ toString() [8/23]

QString QLocale::toString ( int i) const
inline

Definition at line 989 of file qlocale.h.

References i, and toString().

Referenced by toString().

+ 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 985 of file qlocale.h.

References i, and toString().

Referenced by toString().

+ 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 2082 of file qlocale.cpp.

References date, qToStringViewIgnoringNull(), and toString().

+ 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 2144 of file qlocale.cpp.

References date, dateFormat(), QSystemLocale::DateToStringLong, QSystemLocale::DateToStringShort, QDate::isValid(), LongFormat, QLocalePrivate::m_data, QString, systemLocale(), systemLocaleData, and toString().

+ 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 2168 of file qlocale.cpp.

References date, dateFormat(), QSystemLocale::DateToStringLong, QSystemLocale::DateToStringShort, QDate::isValid(), LongFormat, QLocalePrivate::m_data, QString, systemLocale(), systemLocaleData, and toString().

+ 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 2129 of file qlocale.cpp.

References date, and QCalendar::dateTimeToString().

+ 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 2120 of file qlocale.cpp.

References date.

◆ 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 2052 of file qlocale.cpp.

References QLocaleData::GroupDigits, i, QLocaleData::longLongToString(), QLocalePrivate::m_data, QLocalePrivate::m_numberOptions, and OmitGroupSeparator.

Referenced by QQuickSpinBoxPrivate::evaluateTextFromValue(), QIntValidator::fixup(), QDoubleValidatorPrivate::fixupWithLocale(), QAndroidSystemLocale::query(), QProgressBar::text(), QDateTimeEdit::textFromDateTime(), QDoubleSpinBox::textFromValue(), QSpinBox::textFromValue(), ToLocaleDateString(), ToLocaleString(), ToLocaleTimeString(), toString(), toString(), toString(), toString(), toString(), toString(), and toString().

+ Here is the call graph for this function:
+ 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 2095 of file qlocale.cpp.

References qToStringViewIgnoringNull(), time, and toString().

+ 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 2302 of file qlocale.cpp.

References QTime::isValid(), LongFormat, QLocalePrivate::m_data, QString, systemLocale(), systemLocaleData, time, timeFormat(), QSystemLocale::TimeToStringLong, QSystemLocale::TimeToStringShort, and toString().

+ 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 2214 of file qlocale.cpp.

References QCalendar::dateTimeToString(), and time.

+ 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 2066 of file qlocale.cpp.

References QLocaleData::GroupDigits, i, QLocalePrivate::m_data, QLocalePrivate::m_numberOptions, OmitGroupSeparator, and QLocaleData::unsLongLongToString().

+ Here is the call graph for this function:

◆ toString() [20/23]

QString QLocale::toString ( short i) const
inline

Definition at line 987 of file qlocale.h.

References i, and toString().

Referenced by toString().

+ 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 990 of file qlocale.h.

References i, and toString().

Referenced by toString().

+ 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 986 of file qlocale.h.

References i, and toString().

Referenced by toString().

+ 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 988 of file qlocale.h.

References i, and toString().

Referenced by toString().

+ 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 957 of file qlocale.h.

References ok, and qToStringViewIgnoringNull().

+ 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 1913 of file qlocale.cpp.

References ok.

◆ 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 961 of file qlocale.h.

References ok, and qToStringViewIgnoringNull().

+ 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 1952 of file qlocale.cpp.

References ok.

◆ 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 965 of file qlocale.h.

References ok, and qToStringViewIgnoringNull().

+ 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 1994 of file qlocale.cpp.

References ok.

◆ 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 3394 of file qlocale.cpp.

References QLocalePrivate::bcp47Name(), ok, str, and QString::toUpper().

+ 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 953 of file qlocale.h.

References ok, and qToStringViewIgnoringNull().

+ 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 1873 of file qlocale.cpp.

References ok.

◆ uiLanguages()

QStringList QLocale::uiLanguages ( TagSeparator separator = TagSeparator::Dash) const

List of locale names for use in selecting translations.

Since
4.8

Each entry in the returned list is the name of a locale suitable to the user's preferences for what to translate the UI into. Where a name in the list is composed of several tags, they are joined as indicated by separator. Prior to Qt 6.7 a dash was used as separator.

For example, using the default separator QLocale::TagSeparator::Dash, if the user has configured their system to use English as used in the USA, the list would be "en-Latn-US", "en-US", "en". The order of entries is the order in which to check for translations; earlier items in the list are to be preferred over later ones. If your translation files use underscores, rather than dashes, to separate locale tags, pass QLocale::TagSeparator::Underscore as separator.

Most likely you do not need to use this function directly, but just pass the QLocale object to the QTranslator::load() function.

See also
QTranslator, bcp47Name()

Definition at line 4748 of file qlocale.cpp.

References badSeparatorWarning(), d, QString::fromLatin1(), QLocaleId::fromName(), i, j, QLocaleId::name(), Q_ASSERT, sep, systemLocale(), systemLocaleData, QLocaleId::territory_id, QSystemLocale::UILanguages, QLocaleId::withLikelySubtagsAdded(), and QLocaleId::withLikelySubtagsRemoved().

Referenced by QMimeType::comment().

+ Here is the call graph for this function:
+ 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 3300 of file qlocale.cpp.

References QLocalePrivate::m_data, QLocaleData::m_weekend_end, QLocaleData::m_weekend_start, Qt::Monday, Qt::Sunday, systemLocale(), systemLocaleData, weekdays(), and QSystemLocale::Weekdays.

Referenced by weekdays().

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

◆ zeroDigit()

QString QLocale::zeroDigit ( ) const
Since
4.1

Returns the zero digit character of this locale.

This is a single Unicode character but may be encoded as a surrogate pair, so is (since Qt 6.0) returned as a string. In most locales, other digits follow it in Unicode ordering - however, some number systems, notably those using U+3007 as zero, do not have contiguous digits. Use toString() to obtain suitable representations of numbers, rather than trying to construct them from this zero digit.

See also
toString()

Definition at line 2710 of file qlocale.cpp.

References QLocalePrivate::m_data, and QLocaleData::zeroDigit().

Referenced by QAndroidSystemLocale::query().

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

Friends And Related Symbol Documentation

◆ comparesEqual

bool comparesEqual ( const QLocale & lhs,
const QLocale & rhs )
friend

Definition at line 1176 of file qlocale.h.

◆ QByteArray

friend class QByteArray
friend

Definition at line 32 of file qlocale.h.

◆ QCalendarBackend

friend class QCalendarBackend
friend

Definition at line 1172 of file qlocale.h.

◆ QDoubleValidatorPrivate

friend class QDoubleValidatorPrivate
friend

Definition at line 34 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 1164 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 1164 of file qlocale.cpp.

◆ QIntValidator

friend class QIntValidator
friend

Definition at line 33 of file qlocale.h.

◆ QLocalePrivate

friend class QLocalePrivate
friend

Definition at line 1170 of file qlocale.h.

Referenced by matchingLocales().

◆ QRomanCalendar

friend class QRomanCalendar
friend

Definition at line 1173 of file qlocale.h.

◆ QString

friend class QString
friend

Definition at line 31 of file qlocale.h.

Referenced by createSeparatedList(), toString(), toString(), toString(), toString(), and toString().

◆ QSystemLocale

friend class QSystemLocale
friend

Definition at line 1171 of file qlocale.h.

◆ QTextStream

friend class QTextStream
friend

Definition at line 35 of file qlocale.h.

◆ QTextStreamPrivate

friend class QTextStreamPrivate
friend

Definition at line 36 of file qlocale.h.

Member Data Documentation

◆ DefaultTwoDigitBaseYear

QT_BEGIN_NAMESPACE constexpr int QLocale::DefaultTwoDigitBaseYear = 1900
staticconstexpr

Definition at line 39 of file qlocale.h.


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