Warning, /frameworks/ki18n/docs/locale-data-qml-api.md is written in an unsupported language. File is not indexed.

0001 Locale Data QML API   {#locale_data_qml_api}
0002 ==================
0003 
0004 -   [Data Types](#data_types)
0005 -   [Country Lookup](#country_lookup)
0006 -   [Country Subdivision Lookup](#subdiv_lookup)
0007 -   [Timezone Lookup](#timezone_lookup)
0008 -   [Further References](#refs)
0009 
0010 <a name="data_types">
0011 
0012 ## Data Types
0013 
0014 The basic types providing locale data in the C++ API are also
0015 available in QML as `Q_GADGET`s and offer the same properties
0016 in QML:
0017 
0018 \li KCountry
0019 \li KCountrySubdivision
0020 
0021 <a name="country_lookup">
0022 
0023 ## Country Lookup
0024 
0025 The static country lookup methods found in `KCountry` in the C++ API
0026 are available from the `Country` singleton in QML, as part of the `org.kde.i18n.localeData` module.
0027 
0028 ### Listing all
0029 
0030 For listing all known countries there is the `Country.allCountries` property,
0031 providing a list of `KCountry` objects.
0032 
0033 ~~~
0034 import org.kde.i18n.localeData 1.0
0035 
0036 ... {
0037     ComboBox {
0038         model: Country.allCountries
0039         displayText: currentValue.emojiFlag + " " + currentValue.name
0040     }
0041 }
0042 ~~~
0043 
0044 ### Lookup by code, name or location
0045 
0046 The following methods allow to obtain a `KCountry` object:
0047 
0048 \li `Country.fromAlpha2`
0049 \li `Country.fromAlpha3`
0050 \li `Country.fromName`
0051 \li `Country.fromLocation`
0052 
0053 See the corresponding C++ API with the same name in `KCountry` for further details.
0054 
0055 
0056 <a name="subdiv_lookup">
0057 
0058 ## Country Subdivision Lookup
0059 
0060 The static country subdivision lookup methods found in `KCountrySubdivision` in the C++ API
0061 are available from the `CountrySubdivision` singleton in QML, as part of the `org.kde.i18n.localeData` module.
0062 
0063 The following methods allow to obtain a `KCountrySubdivision` object:
0064 
0065 \li `CountrySubdivision.fromCode`
0066 \li `CountrySubdivision.fromLocation`
0067 
0068 See the corresponding C++ API with the same name in `KCountrySubdivision` for further details.
0069 
0070 
0071 <a name="timezone_lookup">
0072 
0073 ## Timezone Lookup
0074 
0075 The static country timezone lookup methods found in `KTimeZone` in the C++ API
0076 are available from the `TimeZone` singleton in QML, as part of the `org.kde.i18n.localeData` module.
0077 
0078 The following methods are provided:
0079 
0080 \li `TimeZone.country`
0081 \li `TimeZone.fromLocation`
0082 
0083 See the corresponding C++ API with the same name in `KTimeZone` for further details.
0084 
0085 
0086 <a name="refs">
0087 
0088 ## Further References
0089 
0090 There's a standalone QML example showing most of the above mentioned functionality in `tests/demo.qml`
0091 provided as part of the KI18n source code.
0092