Obsolete Members for QLocale

QLocale 的以下成员已被弃用。提供这些成员是为了保持旧源代码的正常运行。我们强烈建议不要在新代码中使用它们。

公共函数

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

静态公共成员

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

成员函数文档

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

自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。

返回与 ISO 3166 标准中定义的两位字母或三位数字countryCode 相对应的QLocale::Territory 枚举。

如果代码无效或未知,则返回QLocale::AnyTerritory

请使用codeToTerritory(QStringView) 代替。

此函数在 Qt 6.1 中引入。

另请参阅 territoryToCode()、codeToLanguage() 和codeToScript()。

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

自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。

请使用matchingLocales() 并查阅territory() 。

返回在 Qt 的语言数据库中有language 条目的国家列表。如果结果为空列表,则表示 Qt 的语言数据库中不包含language

另请参阅 matchingLocales()。

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

自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。

请使用territory() 代替。

返回此 locale 的地域。

另请参阅 language()、script()、territoryToString() 和bcp47Name()。

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

自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。

请使用territoryToCode() 代替。

根据 ISO 3166 标准的定义,返回country 的双字母地区代码。

注: 对于QLocale::AnyTerritoryQLocale::AnyCountry ,将返回空字符串。

另请参阅 codeToTerritory()、territory()、name()、bcp47Name()、languageToCode() 和scriptToCode()。

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

自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。

请使用territoryToString() 代替。

返回包含country 名称的QString

另请参阅 languageToString()、scriptToString()、territory() 和bcp47Name()。

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

自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。

请使用nativeTerritoryName() 代替。

返回区域的本地名称。例如,"España "表示西班牙语/西班牙的本地名称。

另请参阅 nativeLanguageName() 和territoryToString()。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.