KCountrySubdivision Class
Information about an ISO 3166-2 country subdivision. More...
Header: | #include <KCountrySubdivision> |
CMake: | find_package(KF6 REQUIRED COMPONENTS I18n) target_link_libraries(mytarget PRIVATE KF6::I18nLocaleData) |
Since: | 5.88 |
Properties
|
Public Functions
KCountrySubdivision() | |
QString | code() const |
KCountry | country() const |
bool | isValid() const |
QString | name() const |
KCountrySubdivision | parent() const |
QList<KCountrySubdivision> | subdivisions() const |
QList<const char *> | timeZoneIds() const |
bool | operator==(const KCountrySubdivision &other) const |
Static Public Members
KCountrySubdivision | fromCode(QStringView code) |
KCountrySubdivision | fromCode(const char *code) |
KCountrySubdivision | fromLocation(float latitude, float longitude) |
Detailed Description
Note: This requires the [iso-codes](https://salsa.debian.org/iso-codes-team/iso-codes/) data files and translation catalogs to be available at runtime.
See KCountry for the data sources.
Property Documentation
[read-only]
code : const QString
Access functions:
QString | code() const |
[read-only]
country : const KCountry
Access functions:
KCountry | country() const |
[read-only]
name : const QString
Access functions:
QString | name() const |
[read-only]
parent : const KCountrySubdivision
Access functions:
KCountrySubdivision | parent() const |
[read-only]
subdivisions : const QList<KCountrySubdivision>
Access functions:
QList<KCountrySubdivision> | subdivisions() const |
[read-only]
timeZoneIds : const QStringList
Member Function Documentation
KCountrySubdivision::KCountrySubdivision()
Creates an invalid/empty KCountrySubdivision instance. See the fromX() methods for creating a valid instance.
QString KCountrySubdivision::code() const
ISO 3166-2 country subdivision code.
Note: Getter function for property code.
KCountry KCountrySubdivision::country() const
Country this subdivision belongs to.
Note: Getter function for property country.
[static]
KCountrySubdivision KCountrySubdivision::fromCode(QStringView code)
Create a KCountrySubdivision instance from an ISO 3166-2 code.
[static]
KCountrySubdivision KCountrySubdivision::fromCode(const char *code)
Create a KCountrySubdivision instance from an ISO 3166-2 code.
[static]
KCountrySubdivision KCountrySubdivision::fromLocation(float latitude, float longitude)
Looks up the country subdivision at the given geographic coordinate. This can return an invalid object if the country subdivision could not be determined. This can happen in a number of cases:
- on oceans
- in polar regions
- close to a land border
- in disputed territories
Note: It is possible for KCountry::fromLocation() to return a valid result despite this method returning an invalid result.
bool KCountrySubdivision::isValid() const
Returns false
if this is an empty/invalid/default constructed instance, true
otherwise.
QString KCountrySubdivision::name() const
Translated country subdivision name.
Note: Getter function for property name.
KCountrySubdivision KCountrySubdivision::parent() const
Parent subdivision, if this is a subdivision of another subdivision. Returns an invalid element for top-level subdivisions.
Note: Getter function for property parent.
QList<KCountrySubdivision> KCountrySubdivision::subdivisions() const
Subdivisions of this subdivision, if any. This is only relevant for countries with multiple ISO 3166-2 subdivision levels.
Note: Getter function for property subdivisions.
QList<const char *> KCountrySubdivision::timeZoneIds() const
Timezones in use in this country subdivision.