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 版本起,此函数已被废弃。我们强烈建议不要在新代码中使用它。
返回与两个字母或三位数字的countryCode (如 ISO 3166 标准所定义)对应的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 条目的国家列表。如果结果为空列表,则说明language 在 Qt 的区域设置数据库中未被支持。
另请参阅 matchingLocales()。
[deprecated in 6.6] QLocale::Country QLocale::country() const
自 6.6 版本起,此函数已被废弃。我们强烈建议不要在新代码中使用它。
请改用territory()。
返回此区域设置的地域。
另请参阅 language()、script()、territoryToString() 和bcp47Name()。
[static, deprecated in 6.6] QString QLocale::countryToCode(QLocale::Country country)
自 6.6 版本起,此函数已被废弃。我们强烈建议不要在新代码中使用它。
请改用territoryToCode()。
返回country 的两位字母地区代码,该代码定义于 ISO 3166 标准中。
注意:对于 QLocale::AnyTerritory 或QLocale::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()。
© 2026 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.