Doc: Fix code snippet that abruptly ends the document

Having the string '*/' appear in a quoted snippet ends the entire
documentation comment. Use a parameter to the \code command to
work around that.

Task-number: QTBUG-86295
Change-Id: Ifcb21a4a0958724ebdb1c9e0eafdc767020d3a7b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This commit is contained in:
Topi Reinio 2020-10-29 15:39:20 +01:00
parent 91384c9918
commit 13e978e827

View File

@ -595,18 +595,18 @@
translated in a way you would expect it. The following example code will
silently break if simply converted using the above mentioned function:
\code
\code *
const QString fp1("C:/Users/dummy/files/content.txt");
const QString fp2("/home/dummy/files/content.txt");
QRegExp re1("*/files/*");
QRegExp re1("\1/files/*");
re1.setPatternSyntax(QRegExp::Wildcard);
... = re1.exactMatch(fp1); // returns true
... = re1.exactMatch(fp2); // returns true
// but converted with QRegularExpression::wildcardToRegularExpression()
QRegularExpression re2(QRegularExpression::wildcardToRegularExpression("*/files/*"));
QRegularExpression re2(QRegularExpression::wildcardToRegularExpression("\1/files/*"));
... = re2.match(fp1).hasMatch(); // returns false
... = re2.match(fp2).hasMatch(); // returns false
\endcode