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

QString(QByteArray) constructor behavior change between Qt5 and Qt6

    XMLWordPrintable

Details

    • All
    • a43dd9a6b1b1218a4c39943ba349416265ab8c68 (qt/qtbase/dev), 40a811645 (tqtc/lts-6.2)

    Description

      With Qt5, the following code will return 3, but with Qt6 it returns 6:

      QString(QByteArray("foo\0\0\0", 6)).size()

      The documentation of QString(QByteArray) still says this:

      Stops copying at the first 0 character, otherwise copies the entire byte array.

      But it looks like that's not true anymore since QByteArrayView was introduced.

      QString::fromUtf8 and QString::fromLatin1 also do this, but the documentation isn't clear about the correct behavior.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            myst6re Jérôme Arzel
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes