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

Removal of QByteArray methods taking QByteArray (in favour of QByteArrayView) is a SIC

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P1: Critical P1: Critical
    • None
    • 6.6
    • None

      In Qt 6 in QByteArray we've ditched a bunch of overloads taking QByteArray, leaving only the ones taking QByteArrayView instead

      https://codereview.qt-project.org/c/qt/qtbase/+/303768

      This change is, well, SIC compared to Qt 5: we can no longer pass to those functions datatypes that convert to QByteArray (and not QByteArrayView).

      We've got a pretty big offender in Qt itself: QStringBuilder. This code works in Qt 5 and doesn't in Qt 6:

      QByteArray a, b, haystack;
      haystack.contains(a % b);
      

      Possible solutions:

      1. re-introduce the overloads taking QByteArray (with the usual shenanigans to avoid ambiguities )
      2. make QStringBuilder convertible not just to the "storage" class but to the respective view class as well (risks dangling, but it's OK in the use-case above. One can always dangle with views QStringView v = str1 + str2, with or without QStringBuilder being used)
      3. make QByteArrayView buildable from any type convertible to QByteArray, incl. QStringBuilder. This is employed by QAnyStringView.

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

            thiago Thiago Macieira
            peppe Giuseppe D'Angelo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes