diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h index c9e90ce62b..2ee7dadcce 100644 --- a/src/corelib/text/qbytearray.h +++ b/src/corelib/text/qbytearray.h @@ -163,7 +163,7 @@ public: [[nodiscard]] QByteArray sliced(qsizetype pos) const { verify(pos, 0); return QByteArray(data() + pos, size() - pos); } [[nodiscard]] QByteArray sliced(qsizetype pos, qsizetype n) const - { verify(pos, n); return QByteArray(data() + pos, n); } + { verify(pos, n); return QByteArray(d.data() + pos, n); } [[nodiscard]] QByteArray chopped(qsizetype len) const { verify(0, len); return sliced(0, size() - len); } diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 31d19f7fe6..63432e5c5e 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -342,7 +342,7 @@ public: [[nodiscard]] QString sliced(qsizetype pos) const { verify(pos, 0); return QString(data() + pos, size() - pos); } [[nodiscard]] QString sliced(qsizetype pos, qsizetype n) const - { verify(pos, n); return QString(data() + pos, n); } + { verify(pos, n); return QString(begin() + pos, n); } [[nodiscard]] QString chopped(qsizetype n) const { verify(0, n); return sliced(0, size() - n); }