summaryrefslogtreecommitdiff
path: root/src/qdoc/qmlvisitor.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-06-18 12:00:17 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-06-18 12:00:19 +0200
commit1a69eaec6ec24f2097b52ee8522e44505b20088f (patch)
treeec0b2d666162a420b493a50b03edd1eb6b6d27bc /src/qdoc/qmlvisitor.cpp
parentfb217099b4e03aaa2893e59470a4fe3ec125c9a7 (diff)
downloadqttools-1a69eaec6ec24f2097b52ee8522e44505b20088f.tar.gz
Eradicate some easy Java-style iterators
Java-style iterators are scheduled for deprecation, or at the very least banned from use in Qt code. There are two more complicated ones left in the code for a later commit. Change-Id: I0c843ddcf2c67793b56ab99a219d36a0694c7b09 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/qdoc/qmlvisitor.cpp')
-rw-r--r--src/qdoc/qmlvisitor.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/qdoc/qmlvisitor.cpp b/src/qdoc/qmlvisitor.cpp
index e41a544f2..042ff67e3 100644
--- a/src/qdoc/qmlvisitor.cpp
+++ b/src/qdoc/qmlvisitor.cpp
@@ -80,12 +80,9 @@ QmlDocVisitor::~QmlDocVisitor()
*/
QQmlJS::AST::SourceLocation QmlDocVisitor::precedingComment(quint32 offset) const
{
- QListIterator<QQmlJS::AST::SourceLocation> it(engine->comments());
- it.toBack();
-
- while (it.hasPrevious()) {
-
- QQmlJS::AST::SourceLocation loc = it.previous();
+ const auto comments = engine->comments();
+ for (auto it = comments.rbegin(), end = comments.rend(); it != end; ++it) {
+ QQmlJS::AST::SourceLocation loc = *it;
if (loc.begin() <= lastEndOffset) {
// Return if we reach the end of the preceding structure.