Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
6.6
-
None
Description
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:
- re-introduce the overloads taking QByteArray (with the usual shenanigans to avoid ambiguities )
- 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)
- make QByteArrayView buildable from any type convertible to QByteArray, incl. QStringBuilder. This is employed by QAnyStringView.