diff options
author | Andy Shaw <andy.shaw@qt.io> | 2019-05-02 08:49:37 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2019-05-02 17:48:39 +0000 |
commit | 047633a9457891a5b1132c6be7b6b5b17729133c (patch) | |
tree | ec2d105c22988a29c63ba02823cc6880aa89d12c | |
parent | 513e29af1d1742abec5034e5d376f743c92f9e77 (diff) |
Cocoa: Get the right zero digit for the locale
Change-Id: Ic23e541e1b12b3c94f8d191cb8fb0f76086b69a5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/corelib/tools/qlocale_mac.mm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm index edbaaf5d18..574cb0714c 100644 --- a/src/corelib/tools/qlocale_mac.mm +++ b/src/corelib/tools/qlocale_mac.mm @@ -332,6 +332,17 @@ static QString macCurrencySymbol(QLocale::CurrencySymbolFormat format) return QString(); } +static QString macZeroDigit() +{ + QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent(); + QCFType<CFNumberFormatterRef> numberFormatter = + CFNumberFormatterCreate(nullptr, locale, kCFNumberFormatterNoStyle); + static const int zeroDigit = 0; + QCFType<CFStringRef> value = CFNumberFormatterCreateStringWithValue(nullptr, numberFormatter, + kCFNumberIntType, &zeroDigit); + return QString::fromCFString(value); +} + #ifndef QT_NO_SYSTEMLOCALE static QString macFormatCurrency(const QSystemLocale::CurrencyToStringArgument &arg) { @@ -437,8 +448,9 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case NegativeSign: case PositiveSign: - case ZeroDigit: break; + case ZeroDigit: + return QVariant(macZeroDigit()); case MeasurementSystem: return QVariant(static_cast<int>(macMeasurementSystem())); |