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 <paul.wicking@qt.io>
This commit is contained in:
parent
925ad78024
commit
c880696f06
@ -604,10 +604,16 @@
|
|||||||
is provided to translate glob patterns into a Perl-compatible regular
|
is provided to translate glob patterns into a Perl-compatible regular
|
||||||
expression that can be used for that purpose.
|
expression that can be used for that purpose.
|
||||||
|
|
||||||
\oldcode
|
For example, if you have code like
|
||||||
|
|
||||||
|
\code
|
||||||
QRegExp wildcard("*.txt");
|
QRegExp wildcard("*.txt");
|
||||||
wildcard.setPatternSyntax(QRegExp::Wildcard);
|
wildcard.setPatternSyntax(QRegExp::Wildcard);
|
||||||
\newcode
|
\endcode
|
||||||
|
|
||||||
|
you can rewrite it as
|
||||||
|
|
||||||
|
\code
|
||||||
auto wildcard = QRegularExpression(QRegularExpression::wildcardToRegularExpression("*.txt"));
|
auto wildcard = QRegularExpression(QRegularExpression::wildcardToRegularExpression("*.txt"));
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
@ -637,7 +643,9 @@
|
|||||||
\c {QRegExp::indexIn} and a growing offset, but can now be easily implemented
|
\c {QRegExp::indexIn} and a growing offset, but can now be easily implemented
|
||||||
with \l QRegularExpressionMatchIterator or \l {QString::indexOf}.
|
with \l QRegularExpressionMatchIterator or \l {QString::indexOf}.
|
||||||
|
|
||||||
\oldcode
|
For example, if you have code like
|
||||||
|
|
||||||
|
\code
|
||||||
QString subject("the quick fox");
|
QString subject("the quick fox");
|
||||||
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
@ -646,7 +654,11 @@
|
|||||||
offset += re.matchedLength();
|
offset += re.matchedLength();
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
\newcode
|
\endcode
|
||||||
|
|
||||||
|
you can rewrite it as
|
||||||
|
|
||||||
|
\code
|
||||||
QRegularExpression re("(\\w+)");
|
QRegularExpression re("(\\w+)");
|
||||||
QString subject("the quick fox");
|
QString subject("the quick fox");
|
||||||
|
|
||||||
@ -675,7 +687,9 @@
|
|||||||
\note \l QRegularExpressionMatchIterator is not capable of performing a
|
\note \l QRegularExpressionMatchIterator is not capable of performing a
|
||||||
backwards search.
|
backwards search.
|
||||||
|
|
||||||
\oldcode
|
For example, if you have code like
|
||||||
|
|
||||||
|
\code
|
||||||
int offset = -1;
|
int offset = -1;
|
||||||
QString subject("Lorem ipsum dolor sit amet, consetetur sadipscing.");
|
QString subject("Lorem ipsum dolor sit amet, consetetur sadipscing.");
|
||||||
|
|
||||||
@ -684,7 +698,11 @@
|
|||||||
--offset;
|
--offset;
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
\newcode
|
\endcode
|
||||||
|
|
||||||
|
you can rewrite it as
|
||||||
|
|
||||||
|
\code
|
||||||
qsizetype from = -1;
|
qsizetype from = -1;
|
||||||
QString subject("Lorem ipsum dolor sit amet, consetetur sadipscing.");
|
QString subject("Lorem ipsum dolor sit amet, consetetur sadipscing.");
|
||||||
|
|
||||||
|
@ -1807,9 +1807,15 @@ inline void QUrlPrivate::validate() const
|
|||||||
help avoid missing QUrl::resolved() calls, and other misuses of
|
help avoid missing QUrl::resolved() calls, and other misuses of
|
||||||
QString to QUrl conversions.
|
QString to QUrl conversions.
|
||||||
|
|
||||||
\oldcode
|
For example, if you have code like
|
||||||
|
|
||||||
|
\code
|
||||||
url = filename; // probably not what you want
|
url = filename; // probably not what you want
|
||||||
\newcode
|
\endcode
|
||||||
|
|
||||||
|
you can rewrite it as
|
||||||
|
|
||||||
|
\code
|
||||||
url = QUrl::fromLocalFile(filename);
|
url = QUrl::fromLocalFile(filename);
|
||||||
url = baseurl.resolved(QUrl(filename));
|
url = baseurl.resolved(QUrl(filename));
|
||||||
\endcode
|
\endcode
|
||||||
|
@ -46,7 +46,9 @@
|
|||||||
QXmlStreamReader for reading XML files. Here are some simple steps to
|
QXmlStreamReader for reading XML files. Here are some simple steps to
|
||||||
port your current code to QXmlStreamReader:
|
port your current code to QXmlStreamReader:
|
||||||
|
|
||||||
\oldcode
|
For example, if you have code like
|
||||||
|
|
||||||
|
\code
|
||||||
QFile *file = new QFile(...);
|
QFile *file = new QFile(...);
|
||||||
QXmlInputSource *source = new QXmlInputSource(file);
|
QXmlInputSource *source = new QXmlInputSource(file);
|
||||||
|
|
||||||
@ -61,7 +63,11 @@
|
|||||||
} else {
|
} else {
|
||||||
... // do error handling
|
... // do error handling
|
||||||
}
|
}
|
||||||
\newcode
|
\endcode
|
||||||
|
|
||||||
|
you can rewrite it as
|
||||||
|
|
||||||
|
\code
|
||||||
QFile file = ...;
|
QFile file = ...;
|
||||||
QXmlStreamReader reader(&file);
|
QXmlStreamReader reader(&file);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user