- Qt 6.10
- Qt Core
- C++ Classes
- QLocale
- Qt 6.10.2 Reference Documentation

# Obsolete Members for QLocale

The following members of class QLocale are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.

## Public Functions

`(deprecated in 6.6)` QLocale::Country | country() const
`(deprecated in 6.6)` QString | nativeCountryName() const

## Static Public Members

`(since 6.1, deprecated in 6.6)` QLocale::Country | codeToCountry(QStringView countryCode)
`(deprecated in 6.6)` QList<QLocale::Country> | countriesForLanguage(QLocale::Language language)
`(deprecated in 6.6)` QString | countryToCode(QLocale::Country country)
`(deprecated in 6.6)` QString | countryToString(QLocale::Country country)

## Member Function Documentation

### `[static noexcept, since 6.1, deprecated in 6.6]` QLocale::Country QLocale::codeToCountry(QStringView countryCode)

This function is deprecated since 6.6. We strongly advise against using it in new code.

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

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

Use codeToTerritory(QStringView) instead.

This function was introduced in Qt 6.1.

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

### `[static, deprecated in 6.6]` QList<QLocale::Country> QLocale::countriesForLanguage(QLocale::Language language)

This function is deprecated since 6.6. We strongly advise against using it in new code.

Use matchingLocales() instead and consult the territory() of each.

Returns the list of countries that have entries for language in Qt's locale database. If the result is an empty list, then language is not represented in Qt's locale database.

See also matchingLocales().

### `[deprecated in 6.6]` QLocale::Country QLocale::country() const

This function is deprecated since 6.6. We strongly advise against using it in new code.

Use territory() instead.

Returns the territory of this locale.

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

### `[static, deprecated in 6.6]` QString QLocale::countryToCode(QLocale::Country country)

This function is deprecated since 6.6. We strongly advise against using it in new code.

Use territoryToCode() instead.

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

Note: For `QLocale::AnyTerritory` or `QLocale::AnyCountry` an empty string is returned.

See also codeToTerritory(), territory(), name(), bcp47Name(), languageToCode(), and scriptToCode().

### `[static, deprecated in 6.6]` QString QLocale::countryToString(QLocale::Country country)

This function is deprecated since 6.6. We strongly advise against using it in new code.

Use territoryToString() instead.

Returns a QString containing the name of country.

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

### `[deprecated in 6.6]` QString QLocale::nativeCountryName() const

This function is deprecated since 6.6. We strongly advise against using it in new code.

Use nativeTerritoryName() instead.

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

See also nativeLanguageName() and territoryToString().