From 25107519e5ec527fddcbda53b0634522802d3aaa Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 11 Feb 2025 16:34:10 +0100 Subject: [PATCH] doc: Add missing fromArray() documentation QAnyStringView::fromArray() was not documented, leading to a broken auto-link that referred to it. Pick-to: 6.8 Change-Id: Ibf3704da8b3f16e56589bd649ce1e63a7cbd3739 Reviewed-by: Thiago Macieira (cherry picked from commit f9334be98e4deb9e9a4a30f5f22e92b571670938) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qanystringview.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/corelib/text/qanystringview.cpp b/src/corelib/text/qanystringview.cpp index dca7e24ed21..ad992fbfc39 100644 --- a/src/corelib/text/qanystringview.cpp +++ b/src/corelib/text/qanystringview.cpp @@ -705,4 +705,23 @@ QDebug operator<<(QDebug d, QAnyStringView s) \sa QString::arg(Args&&...) */ +/*! + \fn template > QAnyStringView QAnyStringView::fromArray(const Char (&string)[Size]) + + Constructs a string view on the full character string literal \a string, + including any trailing \c{Char(0)}. If you don't want the + null-terminator included in the view then you can chop() it off + when you are certain it is at the end. Alternatively you can use + the constructor overload taking an array literal which will create + a view up to, but not including, the first null-terminator in the data. + + \a string must remain valid for the lifetime of this string view + object. + + This function will work with any array literal if \c Char is a + compatible character type. The compatible character types are: \c QChar, \c ushort, \c + char16_t and (on platforms, such as Windows, where it is a 16-bit + type) \c wchar_t. +*/ + QT_END_NAMESPACE