Details
-
Epic
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
None
-
qlocale-qt5-char-to-qt6-string
-
-
13
-
Foundation PM Staging
-
ece0b0279 (dev), d398c0a2a (6.10)
Description
Throughout our code the callers of QLocale APIs that I upgraded from returning QChar to returning QString at 6.0 may still be assuming single-character values.
Examples:
- qtbase/src/widgets/widgets/qspinbox.cpp comparing copy.at(0) == locale.decimalPoint() and similar.
- Same file, later using dec = copy.indexOf(locale.decimalPoint()); but later assuming dec + 1 is where to look for what follows it.
- Qt-dev/qtbase/src/corelib/serialization/qtextstream.cpp comparing data[0] to negativeSign() and positiveSign() returns. mmutz brought this to my attention, sparking this ticket: he is fixing it.
- Same file, QTextStreamPrivate::getReal() looping while (getChar(&c) and assuming it can compare c.toLower() – itself potentially problematic – with the toLower() of various QLocale no-longer-single-char values. It needs to use case-insensitive starts-with tests on the stream of characters and consume them chunkwise.
- qtdeclarative/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp testing QCOMPARE(object->property("decimalPoint").toString().at(0), locale.decimalPoint()); and similar for the other functions, rather than doing a startsWith() test.
- qtcharts/src/charts/axis/valueaxis/valueaxislabel.cpp testing event->text().at(0) != locale.decimalPoint() and similar for negative sign (neglecting positive) and exponential; also ignoring group separator; and testing event->text().at(0).isDigit() assumes BMP digits.
Scan code for calls to these functions
QString decimalPoint() const; QString groupSeparator() const; QString percent() const; QString zeroDigit() const; QString negativeSign() const; QString positiveSign() const; QString exponential() const;
and check for any callers assuming single-character returns (like they used to get in Qt 5).
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-138475 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
660979,2 | tst_QLocale: check negative/positiveSign() is never == u'\0' | dev | qt/qtbase | Status: MERGED | +2 | 0 |
661060,2 | tst_QLocale: check negative/positiveSign() is never == u'\0' | 6.10 | qt/qtbase | Status: MERGED | +2 | 0 |
661068,1 | tst_QLocale: check negative/positiveSign() is never == u'\0' | 6.9 | qt/qtbase | Status: STAGED | +2 | 0 |