From c880696f06dc0ff581d53ff3a9b4543028038a69 Mon Sep 17 00:00:00 2001 From: Luca Di Sera Date: Mon, 22 Nov 2021 17:26:05 +0100 Subject: Doc: Replace use of \oldcode-\newcode The command-pair was recently deprecated. The replacement code should produce an output that is equal to the previous one. Task-number: QTBUG-98499 Change-Id: If26e0d85a174ebc3858b638c34d7f43637eab46d Reviewed-by: Paul Wicking --- src/corelib/doc/src/qt6-changes.qdoc | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'src/corelib/doc/src/qt6-changes.qdoc') diff --git a/src/corelib/doc/src/qt6-changes.qdoc b/src/corelib/doc/src/qt6-changes.qdoc index 0b21ecca45..5d9999abf3 100644 --- a/src/corelib/doc/src/qt6-changes.qdoc +++ b/src/corelib/doc/src/qt6-changes.qdoc @@ -604,10 +604,16 @@ is provided to translate glob patterns into a Perl-compatible regular expression that can be used for that purpose. - \oldcode + For example, if you have code like + + \code QRegExp wildcard("*.txt"); wildcard.setPatternSyntax(QRegExp::Wildcard); - \newcode + \endcode + + you can rewrite it as + + \code auto wildcard = QRegularExpression(QRegularExpression::wildcardToRegularExpression("*.txt")); \endcode @@ -637,7 +643,9 @@ \c {QRegExp::indexIn} and a growing offset, but can now be easily implemented with \l QRegularExpressionMatchIterator or \l {QString::indexOf}. - \oldcode + For example, if you have code like + + \code QString subject("the quick fox"); int offset = 0; @@ -646,7 +654,11 @@ offset += re.matchedLength(); // ... } - \newcode + \endcode + + you can rewrite it as + + \code QRegularExpression re("(\\w+)"); QString subject("the quick fox"); @@ -675,7 +687,9 @@ \note \l QRegularExpressionMatchIterator is not capable of performing a backwards search. - \oldcode + For example, if you have code like + + \code int offset = -1; QString subject("Lorem ipsum dolor sit amet, consetetur sadipscing."); @@ -684,7 +698,11 @@ --offset; // ... } - \newcode + \endcode + + you can rewrite it as + + \code qsizetype from = -1; QString subject("Lorem ipsum dolor sit amet, consetetur sadipscing."); -- cgit v1.2.3