From 40da8302e2facc6ff3663321641fdcaa05df1f86 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 18 Nov 2024 14:43:14 +0100 Subject: [PATCH] doc: Fix QString::slice() code example The snippet referred to had a duplicate identifier to an earlier snippet in the snippet file, causing that one to be quoted instead. Change-Id: Id46f6da807806f874291cd5d4c25b8884e511cfc Reviewed-by: Nicholas Bennett (cherry picked from commit d2c9982a568181d55a9043c8646a4ee88b635fc7) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/doc/snippets/qstring/main.cpp | 4 ++-- src/corelib/text/qstring.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp index 0ccbb9abddf..5e3fa647dd1 100644 --- a/src/corelib/doc/snippets/qstring/main.cpp +++ b/src/corelib/doc/snippets/qstring/main.cpp @@ -912,11 +912,11 @@ void Widget::arrayOperator() void Widget::sliceFunction() { - //! [97] + //! [slice97] QString x = u"Nine pineapples"_s; x.slice(5); // x == "pineapples" x.slice(4, 3); // x == "app" - //! [97] + //! [slice97] } diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 19e0d2d0f69..d4a88da5b75 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -5430,7 +5430,7 @@ QString QString::sliced_helper(QString &str, qsizetype pos, qsizetype n) \note The behavior is undefined if \a pos < 0, \a n < 0, or \a pos + \a n > size(). - \snippet qstring/main.cpp 97 + \snippet qstring/main.cpp slice97 \sa sliced(), first(), last(), chopped(), chop(), truncate() */