Qt::QLocale

目的

QLocale:地方

QLocale is initialized with a language/country pair in its constructor and offers number-to-string and string-to-number conversion functions similar to those in QString.

因此本质来说: 它是一个<语言、国家> pair.

QLocale supports the concept of a default locale, which is determined from the system's locale settings at application startup. The default locale can be changed by calling the static member setDefault(). Setting the default locale has the following effects:

If a QLocale object is constructed with the default constructor, it will use the default locale's settings.

QString::toInt(), QString::toDouble(), etc., interpret the string according to the default locale. If this fails, it falls back on the "C" locale.

QString::arg() uses the default locale to format a number when its position specifier in the format string contains an 'L', e.g. "%L1".

在应用程序启动时,QLocale 支持由系统本地配置中决定的default locale;

当前< language/country >pair 有构造函数确定后, 可能会有如下三种情况发生。

When a language/country pair is specified in the constructor, one of three things can happen:

If the language/country pair is found in the database, it is used.

If the language is found but the country is not, or if the country is AnyCountry, the language is used with the most appropriate available country (for example, Germany for German),

If neither the language nor the country are found, QLocale defaults to the default locale (see setDefault()).
Use language() and country() to determine the actual language and country values used.


Note: For the current keyboard input locale take a look at QInputMethod::locale().
获取输入法本地的locale

最终

最终获取的是数据来源于windows 区域格式设置。如下图所示:
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

道阻且长,行则降至

无聊,打赏求刺激而已

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值