Help plugin: Replace foreach with ranged for loop

Change-Id: Idf7a7182e88aba35dff57ef92e1c873b33cb42a1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2022-10-05 13:13:48 +02:00
parent 9accbdac02
commit ebcc51ecbf
2 changed files with 5 additions and 4 deletions

View File

@@ -250,7 +250,7 @@ void DocSettingsPageWidget::addDocumentation()
QSet<QString> values = Utils::toSet(m_filesToUnregister.values(nameSpace));
values.remove(filePath);
m_filesToUnregister.remove(nameSpace);
foreach (const QString &value, values)
for (const QString &value : qAsConst(values))
m_filesToUnregister.insert(nameSpace, value);
}
}
@@ -259,7 +259,8 @@ void DocSettingsPageWidget::addDocumentation()
if (docsUnableToRegister.contains("UnknownNamespace")) {
formatedFail += QString::fromLatin1("<ul><li><b>%1</b>")
.arg(Tr::tr("Invalid documentation file:"));
foreach (const QString &value, docsUnableToRegister.values("UnknownNamespace"))
const QStringList values = docsUnableToRegister.values("UnknownNamespace");
for (const QString &value : values)
formatedFail += QString::fromLatin1("<ul><li>%2</li></ul>").arg(value);
formatedFail += "</li></ul>";
docsUnableToRegister.remove("UnknownNamespace");

View File

@@ -425,7 +425,7 @@ void GeneralSettingsPage::updateFontSizeSelector()
// try to maintain selection or select closest.
if (!pointSizes.empty()) {
QString n;
foreach (int pointSize, pointSizes)
for (int pointSize : qAsConst(pointSizes))
m_widget->sizeComboBox->addItem(n.setNum(pointSize), QVariant(pointSize));
const int closestIndex = closestPointSizeIndex(m_font.pointSize());
if (closestIndex != -1)
@@ -446,7 +446,7 @@ void GeneralSettingsPage::updateFontStyleSelector()
if (!styles.empty()) {
int normalIndex = -1;
const QString normalStyle = "Normal";
foreach (const QString &style, styles) {
for (const QString &style : styles) {
// try to maintain selection or select 'normal' preferably
const int newIndex = m_widget->styleComboBox->count();
m_widget->styleComboBox->addItem(style);