Doc: updated QString::fromRawData documentation to QRegularExpression

QString::fromRawData code sample still shows the use of QRegExp. This
patch updates it for QRegularExpression and cleans the code.

Change-Id: Iff0f736cdbdd7d35c65fde1496ce9f838a8f5c6d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Samuel Gaist 2017-01-22 00:08:16 +01:00
parent 00bbb4d273
commit cbd7dea83e
2 changed files with 3 additions and 3 deletions

View File

@ -380,14 +380,14 @@ void Widget::fillFunction()
void Widget::fromRawDataFunction()
{
//! [22]
QRegExp pattern;
QRegularExpression pattern("\u00A4");
static const QChar unicode[] = {
0x005A, 0x007F, 0x00A4, 0x0060,
0x1009, 0x0020, 0x0020};
int size = sizeof(unicode) / sizeof(QChar);
QString str = QString::fromRawData(unicode, size);
if (str.contains(QRegExp(pattern))) {
if (str.contains(pattern) {
// ...
//! [22] //! [23]
}

View File

@ -8144,7 +8144,7 @@ bool QString::isRightToLeft() const
to create a deep copy of the data, ensuring that the raw data
isn't modified.
Here's an example of how we can use a QRegExp on raw data in
Here's an example of how we can use a QRegularExpression on raw data in
memory without requiring to copy the data into a QString:
\snippet qstring/main.cpp 22