diff --git a/src/corelib/text/qstringview.cpp b/src/corelib/text/qstringview.cpp index abb7015b689..f4c3ccce66e 100644 --- a/src/corelib/text/qstringview.cpp +++ b/src/corelib/text/qstringview.cpp @@ -359,6 +359,17 @@ QT_BEGIN_NAMESPACE \sa begin(), end(), utf16() */ +/*! + \fn const QChar *QStringView::constData() const + \since 6.0 + + Returns a const pointer to the first character in the string. + + \note The character array represented by the return value is \e not null-terminated. + + \sa data(), begin(), end(), utf16() +*/ + /*! \fn const storage_type *QStringView::utf16() const diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h index e2e1abb62d9..5890515652c 100644 --- a/src/corelib/text/qstringview.h +++ b/src/corelib/text/qstringview.h @@ -236,6 +236,7 @@ public: Q_REQUIRED_RESULT Q_DECL_CONSTEXPR qsizetype size() const noexcept { return m_size; } Q_REQUIRED_RESULT const_pointer data() const noexcept { return reinterpret_cast(m_data); } + Q_REQUIRED_RESULT const_pointer constData() const noexcept { return data(); } Q_REQUIRED_RESULT Q_DECL_CONSTEXPR const storage_type *utf16() const noexcept { return m_data; } Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar operator[](qsizetype n) const