diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-08-11 13:08:00 +0300 |
---|---|---|
committer | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-08-20 06:52:34 +0000 |
commit | 3ef4fac9ff3f785d3ccbda4b28ec2c0ea2ee1b59 (patch) | |
tree | 2f832329d0b76f3b524470af0f97b3bba45ff8d1 /tools/qml | |
parent | c754b71eb4a141536dfb3e6697fbd089f4cba8e9 (diff) |
tools: replace 'foreach' with 'range for'
Mark some local variables or parameters as const
to prevent detach()'ing.
Use qAsConst where is not possible mark as const.
Change-Id: I0a777c3bd855abd3bb1ad0907152360cf4a1050e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tools/qml')
-rw-r--r-- | tools/qml/main.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index d718067616..be62500858 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -192,7 +192,7 @@ public Q_SLOTS: checkForWindow(o); haveOne = true; if (conf && qae) - foreach (PartialScene *ps, conf->completers) + for (PartialScene *ps : qAsConst(conf->completers)) if (o->inherits(ps->itemType().toUtf8().constData())) contain(o, ps->container()); } @@ -413,8 +413,8 @@ static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory) QObject *dummyData = comp.create(); if (comp.isError()) { - QList<QQmlError> errors = comp.errors(); - foreach (const QQmlError &error, errors) + const QList<QQmlError> errors = comp.errors(); + for (const QQmlError &error : errors) qWarning() << error; } @@ -566,7 +566,7 @@ int main(int argc, char *argv[]) if (!dummyDir.isEmpty() && QFileInfo (dummyDir).isDir()) loadDummyDataFiles(e, dummyDir); - foreach (const QString &path, files) { + for (const QString &path : qAsConst(files)) { //QUrl::fromUserInput doesn't treat no scheme as relative file paths #ifndef QT_NO_REGULAREXPRESSION QRegularExpression urlRe("[[:word:]]+://.*"); |