QmlJsEditor: Remove foreach / Q_FOREACH usage

Task-number: QTCREATORBUG-27464
Change-Id: I77741a639d8585d1e0ad04d7c5e6588852202e4a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Artem Sokolovskii
2022-05-17 16:11:03 +02:00
parent 840263eb9a
commit 54d4c4db62
11 changed files with 69 additions and 58 deletions

View File

@@ -123,13 +123,14 @@ public:
QStringList sortedPropertiesWithoutId;
foreach (const QString &property, propertyReader.properties())
const QStringList properties = propertyReader.properties();
for (const QString &property : properties)
if (property != QLatin1String("id"))
sortedPropertiesWithoutId.append(property);
sortedPropertiesWithoutId.sort();
foreach (const QString &property, sortedPropertiesWithoutId)
for (const QString &property : qAsConst(sortedPropertiesWithoutId))
sourcePreview.append(QLatin1String(" ") + property + QLatin1String(": ") + propertyReader.readAstValue(property));
const bool confirm = ComponentNameDialog::go(&componentName, &path, &suffix,
@@ -178,7 +179,7 @@ public:
if (program->members)
astRootNode = program->members->member;
foreach (const QString &property, result)
for (const QString &property : qAsConst(result))
rewriter.removeBindingByName(initializerOfObject(astRootNode), property);
} else {
qWarning() << Q_FUNC_INFO << "parsing failed:" << newComponentSource;
@@ -208,7 +209,7 @@ public:
if (!m_idName.isEmpty())
replacement += QLatin1String("id: ") + m_idName + QLatin1Char('\n');
foreach (const QString &property, result)
for (const QString &property : qAsConst(result))
replacement += property + QLatin1String(": ") + propertyReader.readAstValue(property) + QLatin1Char('\n');
Utils::ChangeSet changes;