From 514cd3af139e4a469d4fd4316e1088eab7b50d3f Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Wed, 24 Mar 2021 12:03:43 +0100 Subject: [PATCH] QgsNumericFormatContext : use QString instead of QChar With Qt6, these methods return strings to be prepared for utf-16 surrogates Do we care? If yes, we need to switch all members of QgsNumericFormatContext to QString --- src/core/numericformats/qgsnumericformat.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/core/numericformats/qgsnumericformat.cpp b/src/core/numericformats/qgsnumericformat.cpp index f0ded258a13f..2aefc19db899 100644 --- a/src/core/numericformats/qgsnumericformat.cpp +++ b/src/core/numericformats/qgsnumericformat.cpp @@ -23,6 +23,7 @@ QgsNumericFormatContext::QgsNumericFormatContext() { QLocale l; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) mThousandsSep = l.groupSeparator(); mDecimalSep = l.decimalPoint(); mPercent = l.percent(); @@ -30,6 +31,18 @@ QgsNumericFormatContext::QgsNumericFormatContext() mNegativeSign = l.negativeSign(); mPositiveSign = l.positiveSign(); mExponential = l.exponential(); +#else + // With Qt6, these methods return strings to be prepared + // for utf-16 surrogates + // Do we care? If yes, we need to switch all members of QgsNumericFormatContext to QString + mThousandsSep = l.groupSeparator().at( 0 ); + mDecimalSep = l.decimalPoint().at( 0 ); + mPercent = l.percent().at( 0 ); + mZeroDigit = l.zeroDigit().at( 0 ); + mNegativeSign = l.negativeSign().at( 0 ); + mPositiveSign = l.positiveSign().at( 0 ); + mExponential = l.exponential().at( 0 ); +#endif } int QgsNumericFormat::sortKey()