From ff94cf69daa2c152fddcc76ee155119931bb5f49 Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Mon, 30 Dec 2019 16:00:28 +0100 Subject: [PATCH] StatusBarIcons: port foreach -> range-based for Signed-off-by: Juraj Oravec --- src/plugins/StatusBarIcons/sbi_iconsmanager.cpp | 3 ++- src/plugins/StatusBarIcons/sbi_networkmanager.cpp | 3 ++- src/plugins/StatusBarIcons/statusbariconsplugin.cpp | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/StatusBarIcons/sbi_iconsmanager.cpp b/src/plugins/StatusBarIcons/sbi_iconsmanager.cpp index c1bd04109..95a2c5d16 100644 --- a/src/plugins/StatusBarIcons/sbi_iconsmanager.cpp +++ b/src/plugins/StatusBarIcons/sbi_iconsmanager.cpp @@ -155,7 +155,8 @@ void SBI_IconsManager::mainWindowCreated(BrowserWindow* window) void SBI_IconsManager::mainWindowDeleted(BrowserWindow* window) { - foreach (QWidget* w, m_windows[window]) { + const auto windows = m_windows[window]; + for (QWidget* w : windows) { window->statusBar()->removeWidget(w); delete w; } diff --git a/src/plugins/StatusBarIcons/sbi_networkmanager.cpp b/src/plugins/StatusBarIcons/sbi_networkmanager.cpp index 9a5e8f63d..acafe7573 100644 --- a/src/plugins/StatusBarIcons/sbi_networkmanager.cpp +++ b/src/plugins/StatusBarIcons/sbi_networkmanager.cpp @@ -44,7 +44,8 @@ void SBI_NetworkManager::loadSettings() { QSettings settings(m_settingsFile, QSettings::IniFormat); - foreach (const QString &group, settings.childGroups()) { + const auto groups = settings.childGroups(); + for (const QString &group : groups) { if (group.isEmpty()) { continue; } diff --git a/src/plugins/StatusBarIcons/statusbariconsplugin.cpp b/src/plugins/StatusBarIcons/statusbariconsplugin.cpp index 91a417517..de679619f 100644 --- a/src/plugins/StatusBarIcons/statusbariconsplugin.cpp +++ b/src/plugins/StatusBarIcons/statusbariconsplugin.cpp @@ -38,7 +38,8 @@ void StatusBarIconsPlugin::init(InitState state, const QString &settingsPath) // Make sure icons are added also to already created windows if (state == LateInitState) { - foreach (BrowserWindow* window, mApp->windows()) { + const auto windows = mApp->windows(); + for (BrowserWindow* window : windows) { m_manager->mainWindowCreated(window); } } @@ -48,7 +49,8 @@ void StatusBarIconsPlugin::unload() { // Make sure icons are properly removed when unloading plugin (but not when closing app) if (!mApp->isClosing()) { - foreach (BrowserWindow* window, mApp->windows()) { + const auto windows = mApp->windows(); + for (BrowserWindow* window : windows) { m_manager->mainWindowDeleted(window); }