diff --git a/src/lib/app/browserwindow.cpp b/src/lib/app/browserwindow.cpp index 70b73518e..5481f369c 100644 --- a/src/lib/app/browserwindow.cpp +++ b/src/lib/app/browserwindow.cpp @@ -229,7 +229,7 @@ BrowserWindow::~BrowserWindow() { mApp->plugins()->emitMainWindowDeleted(this); - foreach (const QPointer &pointer, m_deleteOnCloseWidgets) { + for (const QPointer &pointer : qAsConst(m_deleteOnCloseWidgets)) { if (pointer) { pointer->deleteLater(); } @@ -527,7 +527,7 @@ void BrowserWindow::createEncodingSubMenu(const QString &name, QStringList &code QActionGroup *group = new QActionGroup(subMenu); - foreach (const QString &codecName, codecNames) { + for (const QString &codecName : qAsConst(codecNames)) { QAction *act = createEncodingAction(codecName, activeCodecName, subMenu); group->addAction(act); subMenu->addAction(act); @@ -1084,7 +1084,8 @@ void BrowserWindow::createEncodingMenu(QMenu* menu) QStringList otherCodecs; QStringList allCodecs; - foreach (const int mib, QTextCodec::availableMibs()) { + const auto mibs = QTextCodec::availableMibs(); + for (const int mib : mibs) { const QString codecName = QString::fromUtf8(QTextCodec::codecForMib(mib)->name()); if (!allCodecs.contains(codecName)) @@ -1119,7 +1120,7 @@ void BrowserWindow::createEncodingMenu(QMenu* menu) void BrowserWindow::removeActions(const QList &actions) { - foreach (QAction *action, actions) { + for (QAction *action : actions) { removeAction(action); } } diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index 929b139fc..87355c908 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -155,7 +155,8 @@ MainApplication::MainApplication(int &argc, char** argv) if (argc > 1) { CommandLineOptions cmd; - foreach (const CommandLineOptions::ActionPair &pair, cmd.getActions()) { + const auto actions = cmd.getActions(); + for (const CommandLineOptions::ActionPair &pair : actions) { switch (pair.action) { case Qz::CL_StartWithoutAddons: noAddons = true; @@ -255,7 +256,7 @@ MainApplication::MainApplication(int &argc, char** argv) if (isRunning()) { m_isClosing = true; - foreach (const QString &message, messages) { + for (const QString &message : qAsConst(messages)) { sendMessage(message); } return; @@ -457,7 +458,8 @@ void MainApplication::openSession(BrowserWindow* window, RestoreData &restoreDat window->restoreWindow(restoreData.windows.takeAt(0)); } - foreach (const BrowserWindow::SavedWindow &data, restoreData.windows) { + const auto restoreWindows = restoreData.windows; + for (const BrowserWindow::SavedWindow &data : restoreWindows) { BrowserWindow* window = createWindow(Qz::BW_OtherRestoredWindow); window->restoreWindow(data); }