diff options
Diffstat (limited to 'src/corelib/doc/snippets')
-rw-r--r-- | src/corelib/doc/snippets/code/doc_src_containers.cpp | 8 | ||||
-rw-r--r-- | src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp | 10 | ||||
-rw-r--r-- | src/corelib/doc/snippets/qstring/main.cpp | 8 |
3 files changed, 12 insertions, 14 deletions
diff --git a/src/corelib/doc/snippets/code/doc_src_containers.cpp b/src/corelib/doc/snippets/code/doc_src_containers.cpp index 443f6b688c..84935580c9 100644 --- a/src/corelib/doc/snippets/code/doc_src_containers.cpp +++ b/src/corelib/doc/snippets/code/doc_src_containers.cpp @@ -312,3 +312,11 @@ int j = *i; // Undefined behavior! but with QVector this is likely to crash. */ //! [24] + +//! [25] +QVector<int> vector{1, 2, 3, 4, 4, 5}; +QSet<int> set(vector.begin(), vector.end()); +/* + Will generate a QSet containing 1, 2, 4, 5. +*/ +//! [25] diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp index 11ab50687d..b1dc392140 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp @@ -372,16 +372,13 @@ a = str.toFloat(&ok); // a == 0, ok == false //! [39] QByteArray text("Qt is great!"); text.toBase64(); // returns "UXQgaXMgZ3JlYXQh" -//! [39] -//! [39bis] QByteArray text("<p>Hello?</p>"); text.toBase64(QByteArray::Base64Encoding | QByteArray::OmitTrailingEquals); // returns "PHA+SGVsbG8/PC9wPg" text.toBase64(QByteArray::Base64Encoding); // returns "PHA+SGVsbG8/PC9wPg==" text.toBase64(QByteArray::Base64UrlEncoding); // returns "PHA-SGVsbG8_PC9wPg==" text.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals); // returns "PHA-SGVsbG8_PC9wPg" -//! [39bis] - +//! [39] //! [40] QByteArray ba; @@ -422,13 +419,10 @@ QDataStream in(&data, QIODevice::ReadOnly); //! [44] QByteArray text = QByteArray::fromBase64("UXQgaXMgZ3JlYXQh"); text.data(); // returns "Qt is great!" -//! [44] -//! [44bis] QByteArray::fromBase64("PHA+SGVsbG8/PC9wPg==", QByteArray::Base64Encoding); // returns "<p>Hello?</p>" QByteArray::fromBase64("PHA-SGVsbG8_PC9wPg==", QByteArray::Base64UrlEncoding); // returns "<p>Hello?</p>" -//! [44bis] - +//! [44] //! [45] QByteArray text = QByteArray::fromHex("517420697320677265617421"); diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp index ac7fc7d078..f797890e5d 100644 --- a/src/corelib/doc/snippets/qstring/main.cpp +++ b/src/corelib/doc/snippets/qstring/main.cpp @@ -433,14 +433,12 @@ void Widget::firstIndexOfFunction() //! [93] QString str = "the minimum"; str.indexOf(QRegularExpression("m[aeiou]"), 0); // returns 4 - //! [93] - //! [99] QString str = "the minimum"; QRegularExpressionMatch match; str.indexOf(QRegularExpression("m[aeiou]"), 0, &match); // returns 4 // match.captured() == mi - //! [99] + //! [93] } void Widget::insertFunction() @@ -490,14 +488,12 @@ void Widget::lastIndexOfFunction() //! [94] QString str = "the minimum"; str.lastIndexOf(QRegularExpression("m[aeiou]")); // returns 8 - //! [94] - //! [100] QString str = "the minimum"; QRegularExpressionMatch match; str.lastIndexOf(QRegularExpression("m[aeiou]"), -1, &match); // returns 8 // match.captured() == mu - //! [100] + //! [94] } void Widget::leftFunction() |