summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/code
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2020-06-26 12:17:38 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2020-06-29 18:00:13 +0200
commitc70c4e42665eb34e677fc51a49552c9af3f58d7a (patch)
tree0e7a70f5104025a3cd1ec33db746989415f7bb83 /src/corelib/doc/snippets/code
parentf3c7d22dd04afe8d889585fb5d6426f3d4591e74 (diff)
Use QList instead of QVector in corelib docs
Task-number: QTBUG-84469 Task-number: QTBUG-85221 Change-Id: Ieb0ba7d82409e3c053a5788a01e92ea495505643 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/corelib/doc/snippets/code')
-rw-r--r--src/corelib/doc/snippets/code/doc_src_containers.cpp22
-rw-r--r--src/corelib/doc/snippets/code/doc_src_qalgorithms.cpp82
-rw-r--r--src/corelib/doc/snippets/code/doc_src_qiterator.cpp65
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_global_qrandom.cpp6
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp4
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qlist.cpp136
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qlistdata.cpp280
7 files changed, 125 insertions, 470 deletions
diff --git a/src/corelib/doc/snippets/code/doc_src_containers.cpp b/src/corelib/doc/snippets/code/doc_src_containers.cpp
index 9b23a9056c..e791c0c664 100644
--- a/src/corelib/doc/snippets/code/doc_src_containers.cpp
+++ b/src/corelib/doc/snippets/code/doc_src_containers.cpp
@@ -205,7 +205,7 @@ for (i = splitter->sizes().begin();
//! [15]
-QVector<QString> values;
+QList<QString> values;
...
QString str;
foreach (str, values)
@@ -214,16 +214,16 @@ foreach (str, values)
//! [16]
-QVector<QString> values;
+QList<QString> values;
...
-QVectorIterator<QString> i(values);
+QListIterator<QString> i(values);
while (i.hasNext())
qDebug() << i.next();
//! [16]
//! [17]
-QVector<QString> values;
+QList<QString> values;
...
foreach (const QString &str, values)
qDebug() << str;
@@ -231,7 +231,7 @@ foreach (const QString &str, values)
//! [18]
-QVector<QString> values;
+QList<QString> values;
...
foreach (const QString &str, values) {
if (str.isEmpty())
@@ -284,10 +284,10 @@ QString onlyLetters(const QString &in)
//! [23]
//! [24]
-QVector<int> a, b;
-a.resize(100000); // make a big vector filled with 0.
+QList<int> a, b;
+a.resize(100000); // make a big list filled with 0.
-QVector<int>::iterator i = a.begin();
+QList<int>::iterator i = a.begin();
// WRONG way of using the iterator i:
b = a;
/*
@@ -309,13 +309,13 @@ int j = *i; // Undefined behavior!
/*
The data from b (which i pointed to) is gone.
This would be well-defined with STL containers (and (*i) == 5),
- but with QVector this is likely to crash.
+ but with QList this is likely to crash.
*/
//! [24]
//! [25]
-QVector<int> vector{1, 2, 3, 4, 4, 5};
-QSet<int> set(vector.begin(), vector.end());
+QList<int> list { 1, 2, 3, 4, 4, 5 };
+QSet<int> set(list.begin(), list.end());
/*
Will generate a QSet containing 1, 2, 4, 5.
*/
diff --git a/src/corelib/doc/snippets/code/doc_src_qalgorithms.cpp b/src/corelib/doc/snippets/code/doc_src_qalgorithms.cpp
index b86ea3d7e1..58f6b196b4 100644
--- a/src/corelib/doc/snippets/code/doc_src_qalgorithms.cpp
+++ b/src/corelib/doc/snippets/code/doc_src_qalgorithms.cpp
@@ -105,13 +105,13 @@ QChar resolveEntity(const QString &entity)
QStringList list;
list << "one" << "two" << "three";
-QVector<QString> vect1(3);
-qCopy(list.begin(), list.end(), vect1.begin());
-// vect: [ "one", "two", "three" ]
+QList<QString> list1(3);
+qCopy(list.begin(), list.end(), list1.begin());
+// list1: [ "one", "two", "three" ]
-QVector<QString> vect2(8);
-qCopy(list.begin(), list.end(), vect2.begin() + 2);
-// vect: [ "", "", "one", "two", "three", "", "", "" ]
+QList<QString> list2(8);
+qCopy(list.begin(), list.end(), list2.begin() + 2);
+// list2: [ "", "", "one", "two", "three", "", "", "" ]
//! [4]
@@ -119,26 +119,26 @@ qCopy(list.begin(), list.end(), vect2.begin() + 2);
QStringList list;
list << "one" << "two" << "three";
-QVector<QString> vect(5);
-qCopyBackward(list.begin(), list.end(), vect.end());
-// vect: [ "", "", "one", "two", "three" ]
+QList<QString> backList(5);
+qCopyBackward(list.begin(), list.end(), backList.end());
+// backList: [ "", "", "one", "two", "three" ]
//! [5]
//! [6]
-QStringList list;
-list << "one" << "two" << "three";
+QStringList listLeft;
+listLeft << "one" << "two" << "three";
-QVector<QString> vect(3);
-vect[0] = "one";
-vect[1] = "two";
-vect[2] = "three";
+QList<QString> listRight(3);
+listRight[0] = "one";
+listRight[1] = "two";
+listRight[2] = "three";
-bool ret1 = qEqual(list.begin(), list.end(), vect.begin());
+bool ret1 = qEqual(listLeft.begin(), listLeft.end(), listRight.begin());
// ret1 == true
-vect[2] = "seven";
-bool ret2 = qEqual(list.begin(), list.end(), vect.begin());
+listRight[2] = "seven";
+bool ret2 = qEqual(listLeft.begin(), listLeft.end(), listRight.begin());
// ret2 == false
//! [6]
@@ -281,19 +281,19 @@ list.insert(i, 12);
//! [19]
-QVector<int> vect;
-vect << 3 << 3 << 6 << 6 << 6 << 8;
-QVector<int>::iterator begin6 =
- qLowerBound(vect.begin(), vect.end(), 6);
-QVector<int>::iterator end6 =
- qUpperBound(begin6, vect.end(), 6);
-
-QVector<int>::iterator i = begin6;
+QList<int> list;
+list << 3 << 3 << 6 << 6 << 6 << 8;
+QList<int>::iterator begin6 =
+ qLowerBound(list.begin(), list.end(), 6);
+QList<int>::iterator end6 =
+ qUpperBound(begin6, list.end(), 6);
+
+QList<int>::iterator i = begin6;
while (i != end6) {
*i = 7;
++i;
}
-// vect: [ 3, 3, 7, 7, 7, 8 ]
+// list: [ 3, 3, 7, 7, 7, 8 ]
//! [19]
@@ -312,29 +312,29 @@ list.insert(i, 12);
//! [21]
-QVector<int> vect;
-vect << 3 << 3 << 6 << 6 << 6 << 8;
-QVector<int>::iterator begin6 =
- qLowerBound(vect.begin(), vect.end(), 6);
-QVector<int>::iterator end6 =
- qUpperBound(vect.begin(), vect.end(), 6);
-
-QVector<int>::iterator i = begin6;
+QList<int> list;
+list << 3 << 3 << 6 << 6 << 6 << 8;
+QList<int>::iterator begin6 =
+ qLowerBound(list.begin(), list.end(), 6);
+QList<int>::iterator end6 =
+ qUpperBound(list.begin(), list.end(), 6);
+
+QList<int>::iterator i = begin6;
while (i != end6) {
*i = 7;
++i;
}
-// vect: [ 3, 3, 7, 7, 7, 8 ]
+// list: [ 3, 3, 7, 7, 7, 8 ]
//! [21]
//! [22]
-QVector<int> vect;
-vect << 3 << 3 << 6 << 6 << 6 << 8;
+QList<int> list;
+list << 3 << 3 << 6 << 6 << 6 << 8;
-QVector<int>::iterator i =
- qBinaryFind(vect.begin(), vect.end(), 6);
-// i == vect.begin() + 2 (or 3 or 4)
+QList<int>::iterator i =
+ qBinaryFind(list.begin(), list.end(), 6);
+// i == list.begin() + 2 (or 3 or 4)
//! [22]
diff --git a/src/corelib/doc/snippets/code/doc_src_qiterator.cpp b/src/corelib/doc/snippets/code/doc_src_qiterator.cpp
index 0d0b864a83..265e4a724a 100644
--- a/src/corelib/doc/snippets/code/doc_src_qiterator.cpp
+++ b/src/corelib/doc/snippets/code/doc_src_qiterator.cpp
@@ -64,23 +64,6 @@ while (i.hasPrevious())
qDebug() << i.previous();
//! [1]
-//! [4]
-QVector<float> vector;
-...
-QVectorIterator<float> i(vector);
-while (i.hasNext())
- qDebug() << i.next();
-//! [4]
-
-
-//! [5]
-QVectorIterator<float> i(vector);
-i.toBack();
-while (i.hasPrevious())
- qDebug() << i.previous();
-//! [5]
-
-
//! [6]
QSet<QString> set;
...
@@ -127,35 +110,6 @@ while (i.hasNext()) {
}
//! [10]
-//! [14]
-QVector<float> vector;
-...
-QMutableVectorIterator<float> i(vector);
-while (i.hasNext())
- qDebug() << i.next();
-//! [14]
-
-//! [15]
-QMutableVectorIterator<float> i(vector);
-i.toBack();
-while (i.hasPrevious())
- qDebug() << i.previous();
-//! [15]
-
-
-//! [16]
-QMutableVectorIterator<int> i(vector);
-while (i.hasNext()) {
- int val = i.next();
- if (val < 0) {
- i.setValue(-val);
- } else if (val == 0) {
- i.remove();
- }
-}
-//! [16]
-
-
//! [17]
QSet<float> set;
...
@@ -182,16 +136,6 @@ while (i.hasNext()) {
}
//! [19]
-//! [21]
-QMutableVectorIterator<int> i(vector);
-while (i.hasNext()) {
- int val = i.next();
- if (val < -32768 || val > 32767)
- i.remove();
-}
-//! [21]
-
-
//! [22]
QMutableSetIterator<int> i(set);
while (i.hasNext()) {
@@ -210,15 +154,6 @@ while (i.hasNext()) {
}
//! [23]
-//! [25]
-QMutableVectorIterator<double> i(list);
-while (i.hasNext()) {
- double val = i.next();
- i.setValue(std::sqrt(val));
-}
-//! [25]
-
-
//! [26]
QMap<int, QWidget *> map;
...
diff --git a/src/corelib/doc/snippets/code/src_corelib_global_qrandom.cpp b/src/corelib/doc/snippets/code/src_corelib_global_qrandom.cpp
index 0dc47f2370..9f2884667c 100644
--- a/src/corelib/doc/snippets/code/src_corelib_global_qrandom.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_global_qrandom.cpp
@@ -95,9 +95,9 @@
//! [8]
//! [9]
- QVector<quint32> vector;
- vector.resize(16);
- QRandomGenerator::global()->fillRange(vector.data(), vector.size());
+ QList<quint32> list;
+ list.resize(16);
+ QRandomGenerator::global()->fillRange(list.data(), list.size());
//! [9]
//! [10]
diff --git a/src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp b/src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp
index 973ae75847..cb6928b129 100644
--- a/src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp
@@ -208,7 +208,7 @@
//! [19]
//! [20]
- void appendList(QCborStreamWriter &writer, const QVector<QString> &values)
+ void appendList(QCborStreamWriter &writer, const QList<QString> &values)
{
writer.startArray();
for (const QString &s : values)
@@ -228,7 +228,7 @@
//! [21]
//! [22]
- void appendMap(QCborStreamWriter &writer, const QVector<QPair<int, QString>> &values)
+ void appendMap(QCborStreamWriter &writer, const QList<QPair<int, QString>> &values)
{
writer.startMap();
for (const auto pair : values) {
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qlist.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qlist.cpp
index cdf1ae0eb1..26b952a77a 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qlist.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qlist.cpp
@@ -49,162 +49,162 @@
****************************************************************************/
//! [0]
-QList<int> integerVector;
-QList<QString> stringVector;
+QList<int> integerList;
+QList<QString> stringList;
//! [0]
//! [1]
-QList<QString> vector(200);
+QList<QString> list(200);
//! [1]
//! [2]
-QList<QString> vector(200, "Pass");
+QList<QString> list(200, "Pass");
//! [2]
//! [3]
-if (vector[0] == "Liz")
- vector[0] = "Elizabeth";
+if (list[0] == "Liz")
+ list[0] = "Elizabeth";
//! [3]
//! [4]
-for (int i = 0; i < vector.size(); ++i) {
- if (vector.at(i) == "Alfonso")
+for (int i = 0; i < list.size(); ++i) {
+ if (list.at(i) == "Alfonso")
cout << "Found Alfonso at position " << i << Qt::endl;
}
//! [4]
//! [5]
-int i = vector.indexOf("Harumi");
+int i = list.indexOf("Harumi");
if (i != -1)
cout << "First occurrence of Harumi is at position " << i << Qt::endl;
//! [5]
//! [6]
-QList<int> vector(10);
-int *data = vector.data();
+QList<int> list(10);
+int *data = list.data();
for (int i = 0; i < 10; ++i)
data[i] = 2 * i;
//! [6]
//! [7]
-QList<QString> vector;
-vector.append("one");
-vector.append("two");
+QList<QString> list;
+list.append("one");
+list.append("two");
QString three = "three";
-vector.append(three);
-// vector: ["one", "two", "three"]
+list.append(three);
+// list: ["one", "two", "three"]
// three: "three"
//! [7]
//! [move-append]
-QList<QString> vector;
-vector.append("one");
-vector.append("two");
+QList<QString> list;
+list.append("one");
+list.append("two");
QString three = "three";
-vector.append(std::move(three));
-// vector: ["one", "two", "three"]
+list.append(std::move(three));
+// list: ["one", "two", "three"]
// three: ""
//! [move-append]
//! [emplace]
-QList<QString> vector{"a", "ccc"};
-vector.emplace(1, 2, 'b');
-// vector: ["a", "bb", "ccc"]
+QList<QString> list{"a", "ccc"};
+list.emplace(1, 2, 'b');
+// list: ["a", "bb", "ccc"]
//! [emplace]
//! [emplace-back]
-QList<QString> vector{"one", "two"};
-vector.emplaceBack(3, 'a');
-qDebug() << vector;
-// vector: ["one", "two", "aaa"]
+QList<QString> list{"one", "two"};
+list.emplaceBack(3, 'a');
+qDebug() << list;
+// list: ["one", "two", "aaa"]
//! [emplace-back]
//! [emplace-back-ref]
-QList<QString> vector;
-auto &ref = vector.emplaceBack();
+QList<QString> list;
+auto &ref = list.emplaceBack();
ref = "one";
-// vector: ["one"]
+// list: ["one"]
//! [emplace-back-ref]
//! [8]
-QList<QString> vector;
-vector.prepend("one");
-vector.prepend("two");
-vector.prepend("three");
-// vector: ["three", "two", "one"]
+QList<QString> list;
+list.prepend("one");
+list.prepend("two");
+list.prepend("three");
+// list: ["three", "two", "one"]
//! [8]
//! [9]
-QList<QString> vector;
-vector << "alpha" << "beta" << "delta";
-vector.insert(2, "gamma");
-// vector: ["alpha", "beta", "gamma", "delta"]
+QList<QString> list;
+list << "alpha" << "beta" << "delta";
+list.insert(2, "gamma");
+// list: ["alpha", "beta", "gamma", "delta"]
//! [9]
//! [10]
-QList<double> vector;
-vector << 2.718 << 1.442 << 0.4342;
-vector.insert(1, 3, 9.9);
-// vector: [2.718, 9.9, 9.9, 9.9, 1.442, 0.4342]
+QList<double> list;
+list << 2.718 << 1.442 << 0.4342;
+list.insert(1, 3, 9.9);
+// list: [2.718, 9.9, 9.9, 9.9, 1.442, 0.4342]
//! [10]
//! [11]
-QList<QString> vector(3);
-vector.fill("Yes");
-// vector: ["Yes", "Yes", "Yes"]
+QList<QString> list(3);
+list.fill("Yes");
+// list: ["Yes", "Yes", "Yes"]
-vector.fill("oh", 5);
-// vector: ["oh", "oh", "oh", "oh", "oh"]
+list.fill("oh", 5);
+// list: ["oh", "oh", "oh", "oh", "oh"]
//! [11]
//! [12]
-QList<QString> vector;
-vector << "A" << "B" << "C" << "B" << "A";
-vector.indexOf("B"); // returns 1
-vector.indexOf("B", 1); // returns 1
-vector.indexOf("B", 2); // returns 3
-vector.indexOf("X"); // returns -1
+QList<QString> list;
+list << "A" << "B" << "C" << "B" << "A";
+list.indexOf("B"); // returns 1
+list.indexOf("B", 1); // returns 1
+list.indexOf("B", 2); // returns 3
+list.indexOf("X"); // returns -1
//! [12]
//! [13]
-QList<QString> vector;
-vector << "A" << "B" << "C" << "B" << "A";
-vector.lastIndexOf("B"); // returns 3
-vector.lastIndexOf("B", 3); // returns 3
-vector.lastIndexOf("B", 2); // returns 1
-vector.lastIndexOf("X"); // returns -1
+QList<QString> list;
+list << "A" << "B" << "C" << "B" << "A";
+list.lastIndexOf("B"); // returns 3
+list.lastIndexOf("B", 3); // returns 3
+list.lastIndexOf("B", 2); // returns 1
+list.lastIndexOf("X"); // returns -1
//! [13]
//! [16]
std::vector<double> stdvector;
-vector.push_back(1.2);
-vector.push_back(0.5);
-vector.push_back(3.14);
+stdvector.push_back(1.2);
+stdvector.push_back(0.5);
+stdvector.push_back(3.14);
-QList<double> vector = QList<double>::fromStdVector(stdvector);
+QList<double> list = QList<double>::fromStdVector(stdvector);
//! [16]
//! [17]
-QList<double> vector;
-vector << 1.2 << 0.5 << 3.14;
+QList<double> list;
+list << 1.2 << 0.5 << 3.14;
-std::vector<double> stdvector = vector.toStdVector();
+std::vector<double> stdlist = list.toStdVector();
//! [17]
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qlistdata.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qlistdata.cpp
deleted file mode 100644
index 38fa526ef4..0000000000
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qlistdata.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QList<int> integerList;
-QList<QDate> dateList;
-//! [0]
-
-
-//! [1a]
-QList<QString> list = { "one", "two", "three" };
-//! [1a]
-
-
-//! [1b]
-list << "four" << "five";
-//! [1b]
-
-
-//! [2]
-if (list[0] == "Bob")
- list[0] = "Robert";
-//! [2]
-
-
-//! [3]
-for (int i = 0; i < list.size(); ++i) {
- if (list.at(i) == "Jane")
- cout << "Found Jane at position " << i << Qt::endl;
-}
-//! [3]
-
-
-//! [4]
-QList<QWidget *> list;
-...
-while (!list.isEmpty())
- delete list.takeFirst();
-//! [4]
-
-
-//! [5]
-int i = list.indexOf("Jane");
-if (i != -1)
- cout << "First occurrence of Jane is at position " << i << Qt::endl;
-//! [5]
-
-
-//! [6]
-QList<QString> list;
-list.append("one");
-list.append("two");
-list.append("three");
-// list: ["one", "two", "three"]
-//! [6]
-
-
-//! [7]
-QList<QString> list;
-list.prepend("one");
-list.prepend("two");
-list.prepend("three");
-// list: ["three", "two", "one"]
-//! [7]
-
-
-//! [8]
-QList<QString> list;
-list << "alpha" << "beta" << "delta";
-list.insert(2, "gamma");
-// list: ["alpha", "beta", "gamma", "delta"]
-//! [8]
-
-
-//! [9]
-QList<QString> list;
-list << "sun" << "cloud" << "sun" << "rain";
-list.removeAll("sun");
-// list: ["cloud", "rain"]
-//! [9]
-
-
-//! [10]
-QList<QString> list;
-list << "sun" << "cloud" << "sun" << "rain";
-list.removeOne("sun");
-// list: ["cloud", "sun", "rain"]
-//! [10]
-
-
-//! [11]
-QList<QString> list;
-list << "A" << "B" << "C" << "D" << "E" << "F";
-list.move(1, 4);
-// list: ["A", "C", "D", "E", "B", "F"]
-//! [11]
-
-
-//! [12]
-QList<QString> list;
-list << "A" << "B" << "C" << "D" << "E" << "F";
-list.swapItemsAt(1, 4);
-// list: ["A", "E", "C", "D", "B", "F"]
-//! [12]
-
-
-//! [13]
-QList<QString> list;
-list << "A" << "B" << "C" << "B" << "A";
-list.indexOf("B"); // returns 1
-list.indexOf("B", 1); // returns 1
-list.indexOf("B", 2); // returns 3
-list.indexOf("X"); // returns -1
-//! [13]
-
-
-//! [14]
-QList<QString> list;
-list << "A" << "B" << "C" << "B" << "A";
-list.lastIndexOf("B"); // returns 3
-list.lastIndexOf("B", 3); // returns 3
-list.lastIndexOf("B", 2); // returns 1
-list.lastIndexOf("X"); // returns -1
-//! [14]
-
-
-//! [15]
-QList<QString> list;
-list.append("January");
-list.append("February");
-...
-list.append("December");
-
-QList<QString>::iterator i;
-for (i = list.begin(); i != list.end(); ++i)
- cout << *i << Qt::endl;
-//! [15]
-
-
-//! [16]
-QList<int>::iterator i;
-for (i = list.begin(); i != list.end(); ++i)
- *i += 2;
-//! [16]
-
-
-//! [17]
-QList<QWidget *> list;
-...
-qDeleteAll(list.begin(), list.end());
-//! [17]
-
-
-//! [18]
-if (*it == "Hello")
- *it = "Bonjour";
-//! [18]
-
-
-//! [19]
-QList<QString> list;
-list.append("January");
-list.append("February");
-...
-list.append("December");
-
-QList<QString>::const_iterator i;
-for (i = list.constBegin(); i != list.constEnd(); ++i)
- cout << *i << Qt::endl;
-//! [19]
-
-
-//! [20]
-QList<QWidget *> list;
-...
-qDeleteAll(list.constBegin(), list.constEnd());
-//! [20]
-
-
-//! [21]
-QVector<double> vect;
-vect << 20.0 << 30.0 << 40.0 << 50.0;
-
-QList<double> list = QVector<T>::fromVector(vect);
-// list: [20.0, 30.0, 40.0, 50.0]
-//! [21]
-
-
-//! [22]
-QStringList list;
-list << "Sven" << "Kim" << "Ola";
-
-QVector<QString> vect = list.toVector();
-// vect: ["Sven", "Kim", "Ola"]
-//! [22]
-
-
-//! [23]
-QSet<int> set;
-set << 20 << 30 << 40 << ... << 70;
-
-QList<int> list = QList<int>::fromSet(set);
-std::sort(list.begin(), list.end());
-//! [23]
-
-
-//! [24]
-QStringList list;
-list << "Julia" << "Mike" << "Mike" << "Julia" << "Julia";
-
-QSet<QString> set = list.toSet();
-set.contains("Julia"); // returns true
-set.contains("Mike"); // returns true
-set.size(); // returns 2
-//! [24]
-
-
-//! [25]
-std::list<double> stdlist;
-list.push_back(1.2);
-list.push_back(0.5);
-list.push_back(3.14);
-
-QList<double> list = QList<double>::fromStdList(stdlist);
-//! [25]
-
-
-//! [26]
-QList<double> list;
-list << 1.2 << 0.5 << 3.14;
-
-std::list<double> stdlist = list.toStdList();
-//! [26]