Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-138475

Scan all Qt source for single-char assumptions on QLocale accessors

    XMLWordPrintable

Details

    • Epic
    • Resolution: Unresolved
    • P2: Important
    • None
    • None
    • Core: Locales (i18n)
    • None
    • qlocale-qt5-char-to-qt6-string
    • All
    • 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

        For Gerrit Dashboard: QTBUG-138475
        # Subject Branch Project Status CR V

        Activity

          People

            Eddy Edward Welbourne
            Eddy Edward Welbourne
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes