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:
parent
00bbb4d273
commit
cbd7dea83e
@ -380,14 +380,14 @@ void Widget::fillFunction()
|
|||||||
void Widget::fromRawDataFunction()
|
void Widget::fromRawDataFunction()
|
||||||
{
|
{
|
||||||
//! [22]
|
//! [22]
|
||||||
QRegExp pattern;
|
QRegularExpression pattern("\u00A4");
|
||||||
static const QChar unicode[] = {
|
static const QChar unicode[] = {
|
||||||
0x005A, 0x007F, 0x00A4, 0x0060,
|
0x005A, 0x007F, 0x00A4, 0x0060,
|
||||||
0x1009, 0x0020, 0x0020};
|
0x1009, 0x0020, 0x0020};
|
||||||
int size = sizeof(unicode) / sizeof(QChar);
|
int size = sizeof(unicode) / sizeof(QChar);
|
||||||
|
|
||||||
QString str = QString::fromRawData(unicode, size);
|
QString str = QString::fromRawData(unicode, size);
|
||||||
if (str.contains(QRegExp(pattern))) {
|
if (str.contains(pattern) {
|
||||||
// ...
|
// ...
|
||||||
//! [22] //! [23]
|
//! [22] //! [23]
|
||||||
}
|
}
|
||||||
|
@ -8144,7 +8144,7 @@ bool QString::isRightToLeft() const
|
|||||||
to create a deep copy of the data, ensuring that the raw data
|
to create a deep copy of the data, ensuring that the raw data
|
||||||
isn't modified.
|
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:
|
memory without requiring to copy the data into a QString:
|
||||||
|
|
||||||
\snippet qstring/main.cpp 22
|
\snippet qstring/main.cpp 22
|
||||||
|
Loading…
x
Reference in New Issue
Block a user