diff options
Diffstat (limited to 'src/widgets/itemviews/qdirmodel.cpp')
-rw-r--r-- | src/widgets/itemviews/qdirmodel.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp index 0c157c940f..f18233b64c 100644 --- a/src/widgets/itemviews/qdirmodel.cpp +++ b/src/widgets/itemviews/qdirmodel.cpp @@ -168,9 +168,9 @@ void QDirModelPrivate::invalidate() while (!nodes.empty()) { const QDirNode *current = nodes.pop(); current->stat = false; - const QVector<QDirNode> children = current->children; - for (int i = 0; i < children.count(); ++i) - nodes.push(&children.at(i)); + const QVector<QDirNode> &children = current->children; + for (const auto &child : children) + nodes.push(&child); } } @@ -1022,7 +1022,7 @@ bool QDirModel::rmdir(const QModelIndex &index) return false; QDirModelPrivate::QDirNode *n = d_func()->node(index); - if (!n->info.isDir()) { + if (Q_UNLIKELY(!n->info.isDir())) { qWarning("rmdir: the node is not a directory"); return false; } @@ -1172,7 +1172,7 @@ QDirModelPrivate::QDirNode *QDirModelPrivate::node(int row, QDirNode *parent) co if (isDir && !p->populated) populate(p); // will also resolve symlinks - if (row >= p->children.count()) { + if (Q_UNLIKELY(row >= p->children.count())) { qWarning("node: the row does not exist"); return 0; } |