summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/code
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2020-10-28 13:26:33 +0100
committerAndrei Golubev <andrei.golubev@qt.io>2020-10-28 15:45:53 +0100
commit6b0330317c437749d38db6009932151764f33733 (patch)
treee4b0534a4b4f6ba34680917842a58ba748795364 /src/corelib/doc/snippets/code
parent5dc1780369927b41b424277330d0e2ec7431252b (diff)
Fix QList snippets to use qsizetype instead of int
Task-number: QTBUG-86553 Change-Id: I37e9607e014deaeebfa9fddf2e49a04ee2194cce Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/doc/snippets/code')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qlist.cpp6
1 files changed, 3 insertions, 3 deletions
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 f8ad19e2ae..05027bc500 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qlist.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qlist.cpp
@@ -71,7 +71,7 @@ if (list[0] == "Liz")
//! [4]
-for (int i = 0; i < list.size(); ++i) {
+for (qsizetype i = 0; i < list.size(); ++i) {
if (list.at(i) == "Alfonso")
cout << "Found Alfonso at position " << i << Qt::endl;
}
@@ -79,7 +79,7 @@ for (int i = 0; i < list.size(); ++i) {
//! [5]
-int i = list.indexOf("Harumi");
+qsizetype i = list.indexOf("Harumi");
if (i != -1)
cout << "First occurrence of Harumi is at position " << i << Qt::endl;
//! [5]
@@ -88,7 +88,7 @@ if (i != -1)
//! [6]
QList<int> list(10);
int *data = list.data();
-for (int i = 0; i < 10; ++i)
+for (qsizetype i = 0; i < 10; ++i)
data[i] = 2 * i;
//! [6]