Fix some syntax errors in snippets

- The following error occurs when trying to use these example codes:
"error: expected primary-expression before ‘!=’ token"
- Rename "map" to "hash" in the QHash snippet

Amends 7d542e1daf09caadf6d3e36c4b09bdf94952c5a1.

Change-Id: I1ad5b799f444bf074dbfb44223c00770ecf456c7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 4e367fa17bca5ec9cc7456f9ce2a81466b34027f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Szabolcs David 2023-06-06 15:19:42 +02:00 committed by Qt Cherry-pick Bot
parent f3d0f70949
commit 54eebc4918
3 changed files with 3 additions and 3 deletions

View File

@ -34,7 +34,7 @@ while (i.hasNext()) {
//! [5]
for (auto i = set.cbegin(), end = set.cend(); != end; ++i)
for (auto i = set.cbegin(), end = set.cend(); i != end; ++i)
qDebug() << *i;
//! [5]

View File

@ -57,7 +57,7 @@ while (i.hasNext()) {
//! [8]
for (auto i = map.cbegin(), end = map.cend(); != end; ++i)
for (auto i = hash.cbegin(), end = hash.cend(); i != end; ++i)
cout << qPrintable(i.key()) << ": " << i.value() << endl;
//! [8]

View File

@ -57,7 +57,7 @@ while (i.hasNext()) {
//! [8]
for (auto i = map.cbegin(), end = map.cend(); != end; ++i)
for (auto i = map.cbegin(), end = map.cend(); i != end; ++i)
cout << qPrintable(i.key()) << ": " << i.value() << endl;
//! [8]