diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-10-13 09:06:58 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-10-13 16:37:07 +0000 |
commit | f9bf737d74c2493f7a535048cb4992d3e4cd3c99 (patch) | |
tree | c86f65b9bbe030a0225d0a11d5924fb6e9ada832 /src/corelib/doc | |
parent | dab4877a0a6ad755483a8e47205112a247058fef (diff) |
Examples/Doc snippets: Fix single-character string literals.
Use character literals where applicable.
Change-Id: I79fa5018f05735201ae35ee94ba0d356fcad1056
Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Diffstat (limited to 'src/corelib/doc')
6 files changed, 15 insertions, 15 deletions
diff --git a/src/corelib/doc/snippets/code/doc_src_containers.cpp b/src/corelib/doc/snippets/code/doc_src_containers.cpp index 00971d69b9..395e48bc89 100644 --- a/src/corelib/doc/snippets/code/doc_src_containers.cpp +++ b/src/corelib/doc/snippets/code/doc_src_containers.cpp @@ -176,7 +176,7 @@ QMap<int, int> map; ... QMap<int, int>::const_iterator i; for (i = map.constBegin(); i != map.constEnd(); ++i) - qDebug() << i.key() << ":" << i.value(); + qDebug() << i.key() << ':' << i.value(); //! [13] @@ -236,7 +236,7 @@ foreach (const QString &str, list) { QMap<QString, int> map; ... foreach (const QString &str, map.keys()) - qDebug() << str << ":" << map.value(str); + qDebug() << str << ':' << map.value(str); //! [19] @@ -245,7 +245,7 @@ QMultiMap<QString, int> map; ... foreach (const QString &str, map.uniqueKeys()) { foreach (int i, map.values(str)) - qDebug() << str << ":" << i; + qDebug() << str << ':' << i; } //! [20] diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp index 0ac7cb5769..0976488a48 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp @@ -220,7 +220,7 @@ for (i = hash.begin(); i != hash.end(); ++i) //! [19] QHash<QString, int>::iterator i = hash.begin(); while (i != hash.end()) { - if (i.key().startsWith("_")) + if (i.key().startsWith('_')) i = hash.erase(i); else ++i; @@ -233,7 +233,7 @@ QHash<QString, int>::iterator i = hash.begin(); while (i != hash.end()) { QHash<QString, int>::iterator prev = i; ++i; - if (prev.key().startsWith("_")) + if (prev.key().startsWith('_')) hash.erase(prev); } //! [20] @@ -242,7 +242,7 @@ while (i != hash.end()) { //! [21] // WRONG while (i != hash.end()) { - if (i.key().startsWith("_")) + if (i.key().startsWith('_')) hash.erase(i); ++i; } diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp index 014af8b0ee..f1cf644df6 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp @@ -128,7 +128,7 @@ QLinkedList<QString> list; ... QLinkedList<QString>::iterator i = list.begin(); while (i != list.end()) { - if ((*i).startsWith("_")) + if ((*i).startsWith('_')) i = list.erase(i); else ++i; @@ -141,7 +141,7 @@ QLinkedList<QString>::iterator i = list.begin(); while (i != list.end()) { QLinkedList<QString>::iterator previous = i; ++i; - if ((*previous).startsWith("_")) + if ((*previous).startsWith('_')) list.erase(previous); } //! [11] @@ -150,7 +150,7 @@ while (i != list.end()) { //! [12] // WRONG while (i != list.end()) { - if ((*i).startsWith("_")) + if ((*i).startsWith('_')) list.erase(i); ++i; } diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp index 29e53fc700..3241991129 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp @@ -234,7 +234,7 @@ for (i = map.begin(); i != map.end(); ++i) //! [20] QMap<QString, int>::iterator i = map.begin(); while (i != map.end()) { - if (i.key().startsWith("_")) + if (i.key().startsWith('_')) i = map.erase(i); else ++i; @@ -247,7 +247,7 @@ QMap<QString, int>::iterator i = map.begin(); while (i != map.end()) { QMap<QString, int>::iterator prev = i; ++i; - if (prev.key().startsWith("_")) + if (prev.key().startsWith('_')) map.erase(prev); } //! [21] @@ -256,7 +256,7 @@ while (i != map.end()) { //! [22] // WRONG while (i != map.end()) { - if (i.key().startsWith("_")) + if (i.key().startsWith('_')) map.erase(i); ++i; } diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp index e03e705a0b..d0b5fb00f3 100644 --- a/src/corelib/doc/snippets/qstring/main.cpp +++ b/src/corelib/doc/snippets/qstring/main.cpp @@ -777,10 +777,10 @@ void Widget::splitCaseSensitiveFunction() //! [62] QString str = "a,,b,c"; - QStringList list1 = str.split(","); + QStringList list1 = str.split(','); // list1: [ "a", "", "b", "c" ] - QStringList list2 = str.split(",", QString::SkipEmptyParts); + QStringList list2 = str.split(',', QString::SkipEmptyParts); // list2: [ "a", "b", "c" ] //! [62] } diff --git a/src/corelib/doc/snippets/qstringlist/main.cpp b/src/corelib/doc/snippets/qstringlist/main.cpp index 64f2061786..04d4dc8a89 100644 --- a/src/corelib/doc/snippets/qstringlist/main.cpp +++ b/src/corelib/doc/snippets/qstringlist/main.cpp @@ -82,7 +82,7 @@ Widget::Widget(QWidget *parent) //! [5] //! [6] QStringList list; //! [5] - list = str.split(","); + list = str.split(','); // list: ["Arial", "Helvetica", "Times", "Courier"] //! [6] |