diff --git a/src/lib/adblock/adblockaddsubscriptiondialog.cpp b/src/lib/adblock/adblockaddsubscriptiondialog.cpp index 808ddb46e..9852931b8 100644 --- a/src/lib/adblock/adblockaddsubscriptiondialog.cpp +++ b/src/lib/adblock/adblockaddsubscriptiondialog.cpp @@ -39,7 +39,7 @@ AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(QWidget* parent) << Subscription(QSL("Anti-Adblock Killer"), QSL("https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt")) << Subscription(tr("Other..."), QString()); - for (const Subscription &subscription : qAsConst(m_knownSubscriptions)) { + for (const Subscription &subscription : std::as_const(m_knownSubscriptions)) { ui->comboBox->addItem(subscription.title); } diff --git a/src/lib/adblock/adblockmanager.cpp b/src/lib/adblock/adblockmanager.cpp index e4bf2d221..7b596858d 100644 --- a/src/lib/adblock/adblockmanager.cpp +++ b/src/lib/adblock/adblockmanager.cpp @@ -242,7 +242,7 @@ bool AdBlockManager::removeSubscription(AdBlockSubscription* subscription) AdBlockCustomList* AdBlockManager::customList() const { - for (AdBlockSubscription* subscription : qAsConst(m_subscriptions)) { + for (AdBlockSubscription* subscription : std::as_const(m_subscriptions)) { auto* list = qobject_cast(subscription); if (list) { @@ -330,7 +330,7 @@ void AdBlockManager::load() m_subscriptions.append(customList); // Load all subscriptions - for (AdBlockSubscription* subscription : qAsConst(m_subscriptions)) { + for (AdBlockSubscription* subscription : std::as_const(m_subscriptions)) { subscription->loadSubscription(m_disabledRules); connect(subscription, &AdBlockSubscription::subscriptionUpdated, mApp, &MainApplication::reloadUserStyleSheet); @@ -367,7 +367,7 @@ void AdBlockManager::updateMatcher() void AdBlockManager::updateAllSubscriptions() { - for (AdBlockSubscription* subscription : qAsConst(m_subscriptions)) { + for (AdBlockSubscription* subscription : std::as_const(m_subscriptions)) { subscription->updateSubscription(); } @@ -383,7 +383,7 @@ void AdBlockManager::save() return; } - for (AdBlockSubscription* subscription : qAsConst(m_subscriptions)) { + for (AdBlockSubscription* subscription : std::as_const(m_subscriptions)) { subscription->saveSubscription(); } @@ -428,7 +428,7 @@ QString AdBlockManager::elementHidingRulesForDomain(const QUrl &url) const AdBlockSubscription* AdBlockManager::subscriptionByName(const QString &name) const { - for (AdBlockSubscription* subscription : qAsConst(m_subscriptions)) { + for (AdBlockSubscription* subscription : std::as_const(m_subscriptions)) { if (subscription->title() == name) { return subscription; } diff --git a/src/lib/adblock/adblockmatcher.cpp b/src/lib/adblock/adblockmatcher.cpp index a59bdc223..151e0aa70 100644 --- a/src/lib/adblock/adblockmatcher.cpp +++ b/src/lib/adblock/adblockmatcher.cpp @@ -180,7 +180,7 @@ void AdBlockMatcher::update() } } - for (const AdBlockRule* rule : qAsConst(exceptionCssRules)) { + for (const AdBlockRule* rule : std::as_const(exceptionCssRules)) { const AdBlockRule* originalRule = cssRulesHash.value(rule->cssSelector()); // If we don't have this selector, the exception does nothing diff --git a/src/lib/adblock/adblockrule.cpp b/src/lib/adblock/adblockrule.cpp index 64fee7daa..631f0c21f 100644 --- a/src/lib/adblock/adblockrule.cpp +++ b/src/lib/adblock/adblockrule.cpp @@ -279,14 +279,14 @@ bool AdBlockRule::matchDomain(const QString &domain) const } if (m_blockedDomains.isEmpty()) { - for (const QString &d : qAsConst(m_allowedDomains)) { + for (const QString &d : std::as_const(m_allowedDomains)) { if (isMatchingDomain(domain, d)) { return true; } } } else if (m_allowedDomains.isEmpty()) { - for (const QString &d : qAsConst(m_blockedDomains)) { + for (const QString &d : std::as_const(m_blockedDomains)) { if (isMatchingDomain(domain, d)) { return false; } @@ -294,13 +294,13 @@ bool AdBlockRule::matchDomain(const QString &domain) const return true; } else { - for (const QString &d : qAsConst(m_blockedDomains)) { + for (const QString &d : std::as_const(m_blockedDomains)) { if (isMatchingDomain(domain, d)) { return false; } } - for (const QString &d : qAsConst(m_allowedDomains)) { + for (const QString &d : std::as_const(m_allowedDomains)) { if (isMatchingDomain(domain, d)) { return true; } diff --git a/src/lib/adblock/adblocksubscription.cpp b/src/lib/adblock/adblocksubscription.cpp index 3ec510f0a..d4fb2cb8c 100644 --- a/src/lib/adblock/adblocksubscription.cpp +++ b/src/lib/adblock/adblocksubscription.cpp @@ -334,7 +334,7 @@ void AdBlockCustomList::saveSubscription() textStream << "Url: " << url().toString() << Qt::endl; textStream << "[Adblock Plus 1.1.1]" << Qt::endl; - for (const AdBlockRule* rule : qAsConst(m_rules)) { + for (const AdBlockRule* rule : std::as_const(m_rules)) { textStream << rule->filter() << Qt::endl; } @@ -353,7 +353,7 @@ bool AdBlockCustomList::canBeRemoved() const bool AdBlockCustomList::containsFilter(const QString &filter) const { - for (const AdBlockRule* rule : qAsConst(m_rules)) { + for (const AdBlockRule* rule : std::as_const(m_rules)) { if (rule->filter() == filter) { return true; } diff --git a/src/lib/app/browserwindow.cpp b/src/lib/app/browserwindow.cpp index a0b3f736c..4d53df83c 100644 --- a/src/lib/app/browserwindow.cpp +++ b/src/lib/app/browserwindow.cpp @@ -121,7 +121,7 @@ BrowserWindow::SavedWindow::SavedWindow(BrowserWindow *window) bool BrowserWindow::SavedWindow::isValid() const { - for (const WebTab::SavedTab &tab : qAsConst(tabs)) { + for (const WebTab::SavedTab &tab : std::as_const(tabs)) { if (!tab.isValid()) { return false; } @@ -227,7 +227,7 @@ BrowserWindow::~BrowserWindow() { mApp->plugins()->emitMainWindowDeleted(this); - for (const QPointer &pointer : qAsConst(m_deleteOnCloseWidgets)) { + for (const QPointer &pointer : std::as_const(m_deleteOnCloseWidgets)) { if (pointer) { pointer->deleteLater(); } @@ -525,7 +525,7 @@ void BrowserWindow::createEncodingSubMenu(const QString &name, QStringList &code auto *group = new QActionGroup(subMenu); - for (const QString &codecName : qAsConst(codecNames)) { + for (const QString &codecName : std::as_const(codecNames)) { QAction *act = createEncodingAction(codecName, activeCodecName, subMenu); group->addAction(act); subMenu->addAction(act); diff --git a/src/lib/app/datapaths.cpp b/src/lib/app/datapaths.cpp index 2b1fed84b..3cc13b04e 100644 --- a/src/lib/app/datapaths.cpp +++ b/src/lib/app/datapaths.cpp @@ -105,7 +105,7 @@ void DataPaths::init() m_paths[Plugins].append(QStringLiteral(FALKON_PLUGIN_PATH)); #endif - for (const QString &location : qAsConst(m_paths[AppData])) { + for (const QString &location : std::as_const(m_paths[AppData])) { initAssetsIn(location); } diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index db4119d19..6fc19395b 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -262,7 +262,7 @@ MainApplication::MainApplication(int &argc, char** argv) if (isRunning()) { m_isClosing = true; - for (const QString &message : qAsConst(messages)) { + for (const QString &message : std::as_const(messages)) { sendMessage(message); } return; @@ -735,7 +735,7 @@ void MainApplication::quitApplication() return; } - for (BrowserWindow *window : qAsConst(m_windows)) { + for (BrowserWindow *window : std::as_const(m_windows)) { Q_EMIT window->aboutToClose(); } @@ -745,7 +745,7 @@ void MainApplication::quitApplication() m_isClosing = true; - for (BrowserWindow *window : qAsConst(m_windows)) { + for (BrowserWindow *window : std::as_const(m_windows)) { window->close(); } @@ -785,7 +785,7 @@ QByteArray MainApplication::saveState() const { RestoreData restoreData; restoreData.windows.reserve(m_windows.count()); - for (BrowserWindow *window : qAsConst(m_windows)) { + for (BrowserWindow *window : std::as_const(m_windows)) { restoreData.windows.append(BrowserWindow::SavedWindow(window)); } @@ -1127,7 +1127,7 @@ void MainApplication::checkOptimizeDatabase() void MainApplication::registerAllowedSchemes() { - for (const QString &schemeName : qAsConst(qzSettings->allowedSchemes)) { + for (const QString &schemeName : std::as_const(qzSettings->allowedSchemes)) { if (qzSettings->blockedSchemes.contains(schemeName)) { continue; } diff --git a/src/lib/bookmarks/bookmarksexport/bookmarksexportdialog.cpp b/src/lib/bookmarks/bookmarksexport/bookmarksexportdialog.cpp index 6b9fec03e..885f6004d 100644 --- a/src/lib/bookmarks/bookmarksexport/bookmarksexportdialog.cpp +++ b/src/lib/bookmarks/bookmarksexport/bookmarksexportdialog.cpp @@ -72,7 +72,7 @@ void BookmarksExportDialog::init() { m_exporters.append(new HtmlExporter(this)); - for (BookmarksExporter* exporter : qAsConst(m_exporters)) { + for (BookmarksExporter* exporter : std::as_const(m_exporters)) { ui->format->addItem(exporter->name()); } diff --git a/src/lib/bookmarks/bookmarksimport/firefoximporter.cpp b/src/lib/bookmarks/bookmarksimport/firefoximporter.cpp index 8d9df212c..2b2f4c444 100644 --- a/src/lib/bookmarks/bookmarksimport/firefoximporter.cpp +++ b/src/lib/bookmarks/bookmarksimport/firefoximporter.cpp @@ -126,7 +126,7 @@ BookmarkItem* FirefoxImporter::importBookmarks() QHash hash; - for (const Item &item : qAsConst(items)) { + for (const Item &item : std::as_const(items)) { BookmarkItem* parent = hash.value(item.parent); auto* bookmark = new BookmarkItem(item.type, parent ? parent : root); bookmark->setTitle(item.title.isEmpty() ? item.url.toString() : item.title); diff --git a/src/lib/bookmarks/bookmarksmodel.cpp b/src/lib/bookmarks/bookmarksmodel.cpp index f087f3ca1..1a04e8e02 100644 --- a/src/lib/bookmarks/bookmarksmodel.cpp +++ b/src/lib/bookmarks/bookmarksmodel.cpp @@ -252,7 +252,7 @@ bool BookmarksModel::dropMimeData(const QMimeData* data, Qt::DropAction action, row = qMax(row, 0); - for (BookmarkItem* itm : qAsConst(items)) { + for (BookmarkItem* itm : std::as_const(items)) { // If we are moving an item through the folder and item is above the row to insert, // we must decrease row by one (by the dropped folder) if (itm->parent() == parentItm && itm->parent()->children().indexOf(itm) < row) { diff --git a/src/lib/cookies/cookiejar.cpp b/src/lib/cookies/cookiejar.cpp index b73d295aa..79407b908 100644 --- a/src/lib/cookies/cookiejar.cpp +++ b/src/lib/cookies/cookiejar.cpp @@ -81,7 +81,7 @@ void CookieJar::deleteAllCookies(bool deleteAll) return; } - for (const QNetworkCookie &cookie : qAsConst(m_cookies)) { + for (const QNetworkCookie &cookie : std::as_const(m_cookies)) { if (!listMatchesDomain(m_whitelist, cookie.domain())) { m_client->deleteCookie(cookie); } diff --git a/src/lib/cookies/cookiemanager.cpp b/src/lib/cookies/cookiemanager.cpp index d198103c6..e12a3bffb 100644 --- a/src/lib/cookies/cookiemanager.cpp +++ b/src/lib/cookies/cookiemanager.cpp @@ -135,7 +135,7 @@ void CookieManager::remove() } } - for (const QNetworkCookie &cookie : qAsConst(cookies)) { + for (const QNetworkCookie &cookie : std::as_const(cookies)) { mApp->cookieJar()->deleteCookie(cookie); } } diff --git a/src/lib/downloads/downloadmanager.cpp b/src/lib/downloads/downloadmanager.cpp index 440bd9068..29d4bfd44 100644 --- a/src/lib/downloads/downloadmanager.cpp +++ b/src/lib/downloads/downloadmanager.cpp @@ -209,20 +209,20 @@ void DownloadManager::timerEvent(QTimerEvent* e) } QTime remaining; - for (const QTime &time : qAsConst(remTimes)) { + for (const QTime &time : std::as_const(remTimes)) { if (time > remaining) { remaining = time; } } int progress = 0; - for (int prog : qAsConst(progresses)) { + for (int prog : std::as_const(progresses)) { progress += prog; } progress = progress / progresses.count(); double speed = 0.00; - for (double spee : qAsConst(speeds)) { + for (double spee : std::as_const(speeds)) { speed += spee; } diff --git a/src/lib/history/historymodel.cpp b/src/lib/history/historymodel.cpp index b98992cb8..1d5156980 100644 --- a/src/lib/history/historymodel.cpp +++ b/src/lib/history/historymodel.cpp @@ -322,7 +322,7 @@ void HistoryModel::fetchMore(const QModelIndex &parent) beginInsertRows(parent, 0, list.size() - 1); - for (const HistoryEntry &entry : qAsConst(list)) { + for (const HistoryEntry &entry : std::as_const(list)) { auto* newItem = new HistoryItem(parentItem); newItem->historyEntry = entry; } diff --git a/src/lib/navigation/completer/locationcompleterdelegate.cpp b/src/lib/navigation/completer/locationcompleterdelegate.cpp index b36cd389f..7bca18142 100644 --- a/src/lib/navigation/completer/locationcompleterdelegate.cpp +++ b/src/lib/navigation/completer/locationcompleterdelegate.cpp @@ -280,7 +280,7 @@ int LocationCompleterDelegate::viewItemDrawText(QPainter *p, const QStyleOptionV // Look for longer parts first std::sort(searchStrings.begin(), searchStrings.end(), sizeBiggerThan); - for (const QString &string : qAsConst(searchStrings)) { + for (const QString &string : std::as_const(searchStrings)) { int delimiter = text.indexOf(string, 0, Qt::CaseInsensitive); while (delimiter != -1) { diff --git a/src/lib/navigation/completer/locationcompletermodel.cpp b/src/lib/navigation/completer/locationcompletermodel.cpp index 9b6b11f42..067f4d122 100644 --- a/src/lib/navigation/completer/locationcompletermodel.cpp +++ b/src/lib/navigation/completer/locationcompletermodel.cpp @@ -126,7 +126,7 @@ QSqlQuery LocationCompleterModel::createHistoryQuery(const QString &searchString sqlQuery.addBindValue(QSL("%%1%").arg(searchString)); } else { - for (const QString &str : qAsConst(searchList)) { + for (const QString &str : std::as_const(searchList)) { sqlQuery.addBindValue(QSL("%%1%").arg(str)); sqlQuery.addBindValue(QSL("%%1%").arg(str)); } diff --git a/src/lib/navigation/completer/locationcompleterrefreshjob.cpp b/src/lib/navigation/completer/locationcompleterrefreshjob.cpp index 3632e7d0a..d8b749c96 100644 --- a/src/lib/navigation/completer/locationcompleterrefreshjob.cpp +++ b/src/lib/navigation/completer/locationcompleterrefreshjob.cpp @@ -100,7 +100,7 @@ void LocationCompleterRefreshJob::runJob() } // Load all icons into QImage - for (QStandardItem* item : qAsConst(m_items)) { + for (QStandardItem* item : std::as_const(m_items)) { if (m_jobCancelled) { return; } diff --git a/src/lib/navigation/navigationbar.cpp b/src/lib/navigation/navigationbar.cpp index 79d598997..9e0c6ecd3 100644 --- a/src/lib/navigation/navigationbar.cpp +++ b/src/lib/navigation/navigationbar.cpp @@ -221,7 +221,7 @@ void NavigationBar::setSplitterSizes(int locationBar, int websearchBar) void NavigationBar::setCurrentView(TabbedWebView *view) { - for (const WidgetData &data : qAsConst(m_widgets)) { + for (const WidgetData &data : std::as_const(m_widgets)) { if (data.button) { data.button->setWebView(view); } @@ -437,7 +437,7 @@ void NavigationBar::aboutToShowToolsMenu() m_window->createSidebarsMenu(m_menuTools->addMenu(tr("Sidebar"))); m_menuTools->addSeparator(); - for (const WidgetData &data : qAsConst(m_widgets)) { + for (const WidgetData &data : std::as_const(m_widgets)) { AbstractButtonInterface *button = data.button; if (button && (!button->isVisible() || !m_layoutIds.contains(data.id))) { QString title = button->title(); @@ -570,7 +570,7 @@ void NavigationBar::reloadLayout() } // Add widgets to layout - for (const QString &id : qAsConst(m_layoutIds)) { + for (const QString &id : std::as_const(m_layoutIds)) { const WidgetData data = m_widgets.value(id); if (data.widget) { m_layout->addWidget(data.widget); diff --git a/src/lib/navigation/navigationbarconfigdialog.cpp b/src/lib/navigation/navigationbarconfigdialog.cpp index 5c88490f9..ca4c92835 100644 --- a/src/lib/navigation/navigationbarconfigdialog.cpp +++ b/src/lib/navigation/navigationbarconfigdialog.cpp @@ -54,7 +54,7 @@ void NavigationBarConfigDialog::loadSettings() }; ui->currentItems->clear(); - for (const QString &id : qAsConst(m_navigationBar->m_layoutIds)) { + for (const QString &id : std::as_const(m_navigationBar->m_layoutIds)) { NavigationBar::WidgetData data = m_navigationBar->m_widgets.value(id); if (data.id.isEmpty()) { data.id = id; @@ -64,7 +64,7 @@ void NavigationBarConfigDialog::loadSettings() } ui->availableItems->clear(); - for (const NavigationBar::WidgetData &data : qAsConst(m_navigationBar->m_widgets)) { + for (const NavigationBar::WidgetData &data : std::as_const(m_navigationBar->m_widgets)) { if (!m_navigationBar->m_layoutIds.contains(data.id)) { ui->availableItems->addItem(createItem(data)); } diff --git a/src/lib/network/networkurlinterceptor.cpp b/src/lib/network/networkurlinterceptor.cpp index cd49b564c..2dc20fe6c 100644 --- a/src/lib/network/networkurlinterceptor.cpp +++ b/src/lib/network/networkurlinterceptor.cpp @@ -58,7 +58,7 @@ void NetworkUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) } } - for (UrlInterceptor *interceptor : qAsConst(m_interceptors)) { + for (UrlInterceptor *interceptor : std::as_const(m_interceptors)) { interceptor->interceptRequest(info); } } diff --git a/src/lib/opensearch/searchenginesmanager.cpp b/src/lib/opensearch/searchenginesmanager.cpp index 78828f421..e36a35200 100644 --- a/src/lib/opensearch/searchenginesmanager.cpp +++ b/src/lib/opensearch/searchenginesmanager.cpp @@ -118,7 +118,7 @@ SearchEngine SearchEnginesManager::engineForShortcut(const QString &shortcut) return returnEngine; } - for (const Engine &en : qAsConst(m_allEngines)) { + for (const Engine &en : std::as_const(m_allEngines)) { if (en.shortcut == shortcut) { returnEngine = en; break; @@ -216,7 +216,7 @@ void SearchEnginesManager::engineChangedImage() return; } - for (Engine e : qAsConst(m_allEngines)) { + for (Engine e : std::as_const(m_allEngines)) { if (e.name == engine->name() && e.url.contains(engine->searchUrl(QSL("%s")).toString()) && !engine->image().isNull() @@ -495,7 +495,7 @@ void SearchEnginesManager::saveSettings() QSqlQuery query(SqlDatabase::instance()->database()); query.exec(QSL("DELETE FROM search_engines")); - for (const Engine &en : qAsConst(m_allEngines)) { + for (const Engine &en : std::as_const(m_allEngines)) { query.prepare(QSL("INSERT INTO search_engines (name, icon, url, shortcut, suggestionsUrl, suggestionsParameters, postData) VALUES (?, ?, ?, ?, ?, ?, ?)")); query.addBindValue(en.name); query.addBindValue(iconToBase64(en.icon)); diff --git a/src/lib/plugins/pluginproxy.cpp b/src/lib/plugins/pluginproxy.cpp index 66a7155af..5a118c809 100644 --- a/src/lib/plugins/pluginproxy.cpp +++ b/src/lib/plugins/pluginproxy.cpp @@ -96,7 +96,7 @@ void PluginProxy::populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTe return; } - for (PluginInterface* iPlugin : qAsConst(m_loadedPlugins)) { + for (PluginInterface* iPlugin : std::as_const(m_loadedPlugins)) { iPlugin->populateWebViewMenu(menu, view, r); } } @@ -107,7 +107,7 @@ void PluginProxy::populateExtensionsMenu(QMenu *menu) return; } - for (PluginInterface* iPlugin : qAsConst(m_loadedPlugins)) { + for (PluginInterface* iPlugin : std::as_const(m_loadedPlugins)) { iPlugin->populateExtensionsMenu(menu); } } @@ -116,7 +116,7 @@ bool PluginProxy::processMouseDoubleClick(Qz::ObjectName type, QObject* obj, QMo { bool accepted = false; - for (PluginInterface* iPlugin : qAsConst(m_mouseDoubleClickHandlers)) { + for (PluginInterface* iPlugin : std::as_const(m_mouseDoubleClickHandlers)) { if (iPlugin->mouseDoubleClick(type, obj, event)) { accepted = true; } @@ -129,7 +129,7 @@ bool PluginProxy::processMousePress(Qz::ObjectName type, QObject* obj, QMouseEve { bool accepted = false; - for (PluginInterface* iPlugin : qAsConst(m_mousePressHandlers)) { + for (PluginInterface* iPlugin : std::as_const(m_mousePressHandlers)) { if (iPlugin->mousePress(type, obj, event)) { accepted = true; } @@ -142,7 +142,7 @@ bool PluginProxy::processMouseRelease(Qz::ObjectName type, QObject* obj, QMouseE { bool accepted = false; - for (PluginInterface* iPlugin : qAsConst(m_mouseReleaseHandlers)) { + for (PluginInterface* iPlugin : std::as_const(m_mouseReleaseHandlers)) { if (iPlugin->mouseRelease(type, obj, event)) { accepted = true; } @@ -155,7 +155,7 @@ bool PluginProxy::processMouseMove(Qz::ObjectName type, QObject* obj, QMouseEven { bool accepted = false; - for (PluginInterface* iPlugin : qAsConst(m_mouseMoveHandlers)) { + for (PluginInterface* iPlugin : std::as_const(m_mouseMoveHandlers)) { if (iPlugin->mouseMove(type, obj, event)) { accepted = true; } @@ -168,7 +168,7 @@ bool PluginProxy::processWheelEvent(Qz::ObjectName type, QObject* obj, QWheelEve { bool accepted = false; - for (PluginInterface* iPlugin : qAsConst(m_wheelEventHandlers)) { + for (PluginInterface* iPlugin : std::as_const(m_wheelEventHandlers)) { if (iPlugin->wheelEvent(type, obj, event)) { accepted = true; } @@ -181,7 +181,7 @@ bool PluginProxy::processKeyPress(Qz::ObjectName type, QObject* obj, QKeyEvent* { bool accepted = false; - for (PluginInterface* iPlugin : qAsConst(m_keyPressHandlers)) { + for (PluginInterface* iPlugin : std::as_const(m_keyPressHandlers)) { if (iPlugin->keyPress(type, obj, event)) { accepted = true; } @@ -194,7 +194,7 @@ bool PluginProxy::processKeyRelease(Qz::ObjectName type, QObject* obj, QKeyEvent { bool accepted = false; - for (PluginInterface* iPlugin : qAsConst(m_keyReleaseHandlers)) { + for (PluginInterface* iPlugin : std::as_const(m_keyReleaseHandlers)) { if (iPlugin->keyRelease(type, obj, event)) { accepted = true; } @@ -207,7 +207,7 @@ bool PluginProxy::acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEn { bool accepted = true; - for (PluginInterface* iPlugin : qAsConst(m_loadedPlugins)) { + for (PluginInterface* iPlugin : std::as_const(m_loadedPlugins)) { if (!iPlugin->acceptNavigationRequest(page, url, type, isMainFrame)) { accepted = false; } diff --git a/src/lib/plugins/plugins.cpp b/src/lib/plugins/plugins.cpp index 73350afb4..e7006fd01 100644 --- a/src/lib/plugins/plugins.cpp +++ b/src/lib/plugins/plugins.cpp @@ -164,7 +164,7 @@ void Plugins::loadSettings() void Plugins::shutdown() { - for (PluginInterface* iPlugin : qAsConst(m_loadedPlugins)) { + for (PluginInterface* iPlugin : std::as_const(m_loadedPlugins)) { iPlugin->unload(); } } @@ -226,7 +226,7 @@ void Plugins::loadPlugins() settingsDir.mkdir(settingsDir.absolutePath()); } - for (const QString &pluginId : qAsConst(m_allowedPlugins)) { + for (const QString &pluginId : std::as_const(m_allowedPlugins)) { Plugin plugin = loadPlugin(pluginId); if (plugin.type == Plugin::Invalid) { continue; @@ -306,7 +306,7 @@ void Plugins::refreshLoadedPlugins() { m_loadedPlugins.clear(); - for (const Plugin &plugin : qAsConst(m_availablePlugins)) { + for (const Plugin &plugin : std::as_const(m_availablePlugins)) { if (plugin.isLoaded()) { m_loadedPlugins.append(plugin.instance); } diff --git a/src/lib/plugins/qml/api/bookmarks/qmlbookmarks.cpp b/src/lib/plugins/qml/api/bookmarks/qmlbookmarks.cpp index dd336acb2..40c2ab8e3 100644 --- a/src/lib/plugins/qml/api/bookmarks/qmlbookmarks.cpp +++ b/src/lib/plugins/qml/api/bookmarks/qmlbookmarks.cpp @@ -64,7 +64,7 @@ BookmarkItem *QmlBookmarks::getBookmarkItem(QmlBookmarkTreeNode *treeNode) const items = bookmarks->searchBookmarks(QUrl::fromEncoded(treeNode->url().toUtf8())); } - for (BookmarkItem *item : qAsConst(items)) { + for (BookmarkItem *item : std::as_const(items)) { if (treeNode->item() == item) { return item; } @@ -182,7 +182,7 @@ QList QmlBookmarks::search(const QVariantMap &map) const } QList ret; ret.reserve(items.size()); - for (auto item : qAsConst(items)) { + for (auto item : std::as_const(items)) { ret.append(QmlStaticData::instance().getBookmarkTreeNode(item)); } return ret; diff --git a/src/lib/plugins/qml/api/cookies/qmlcookies.cpp b/src/lib/plugins/qml/api/cookies/qmlcookies.cpp index 9c5b5693f..f707b35b0 100644 --- a/src/lib/plugins/qml/api/cookies/qmlcookies.cpp +++ b/src/lib/plugins/qml/api/cookies/qmlcookies.cpp @@ -51,7 +51,7 @@ QNetworkCookie QmlCookies::getNetworkCookie(const QVariantMap &map) const QString name = map.value(QSL("name")).toString(); const QString url = map.value(QSL("url")).toString(); QVector cookies = mApp->cookieJar()->getAllCookies(); - for (const QNetworkCookie &cookie : qAsConst(cookies)) { + for (const QNetworkCookie &cookie : std::as_const(cookies)) { if (QString::fromUtf8(cookie.name()) == name && cookie.domain() == url) { return cookie; } @@ -74,7 +74,7 @@ QList QmlCookies::getAll(const QVariantMap &map) const bool secure = map.value(QSL("secure")).toBool(); const bool session = map.value(QSL("session")).toBool(); QVector cookies = mApp->cookieJar()->getAllCookies(); - for (QNetworkCookie cookie : qAsConst(cookies)) { + for (QNetworkCookie cookie : std::as_const(cookies)) { if ((!map.contains(QSL("name")) || QString::fromUtf8(cookie.name()) == name) && (!map.contains(QSL("url")) || cookie.domain() == url) && (!map.contains(QSL("path")) || cookie.path() == path) diff --git a/src/lib/plugins/qml/api/userscript/qmlexternaljsobject.cpp b/src/lib/plugins/qml/api/userscript/qmlexternaljsobject.cpp index a95949d7d..e2937e76b 100644 --- a/src/lib/plugins/qml/api/userscript/qmlexternaljsobject.cpp +++ b/src/lib/plugins/qml/api/userscript/qmlexternaljsobject.cpp @@ -26,7 +26,7 @@ QmlExternalJsObject::QmlExternalJsObject(QObject *parent) QmlExternalJsObject::~QmlExternalJsObject() { - for (QObject *object : qAsConst(m_objects)) { + for (QObject *object : std::as_const(m_objects)) { ExternalJsObject::unregisterExtraObject(object); } } diff --git a/src/lib/plugins/qml/qmlplugininterface.cpp b/src/lib/plugins/qml/qmlplugininterface.cpp index f12d6a46e..2aeee18a2 100644 --- a/src/lib/plugins/qml/qmlplugininterface.cpp +++ b/src/lib/plugins/qml/qmlplugininterface.cpp @@ -69,7 +69,7 @@ void QmlPluginInterface::unload() m_unload.call(); - for (QObject *childItem : qAsConst(m_childItems)) { + for (QObject *childItem : std::as_const(m_childItems)) { childItem->deleteLater(); } diff --git a/src/lib/plugins/speeddial.cpp b/src/lib/plugins/speeddial.cpp index d0ddeba05..cce0cc24d 100644 --- a/src/lib/plugins/speeddial.cpp +++ b/src/lib/plugins/speeddial.cpp @@ -101,7 +101,7 @@ SpeedDial::Page SpeedDial::pageForUrl(const QUrl &url) if (urlString.endsWith(QL1C('/'))) urlString = urlString.left(urlString.size() - 1); - for (const Page &page : qAsConst(m_pages)) { + for (const Page &page : std::as_const(m_pages)) { if (page.url == urlString) { return page; } @@ -207,7 +207,7 @@ QString SpeedDial::initialScript() QVariantList pages; - for (const Page &page : qAsConst(m_pages)) { + for (const Page &page : std::as_const(m_pages)) { QString imgSource = m_thumbnailsDir + QString::fromLatin1(QCryptographicHash::hash(page.url.toUtf8(), QCryptographicHash::Md4).toHex()) + QSL(".png"); if (!QFile(imgSource).exists()) { @@ -374,7 +374,7 @@ QString SpeedDial::generateAllPages() { QString allPages; - for (const Page &page : qAsConst(m_pages)) { + for (const Page &page : std::as_const(m_pages)) { const QString string = QSL(R"(url:"%1"|title:"%2";)").arg(page.url, page.title); allPages.append(string); } diff --git a/src/lib/session/restoremanager.cpp b/src/lib/session/restoremanager.cpp index f2a7af60d..b77f985b8 100644 --- a/src/lib/session/restoremanager.cpp +++ b/src/lib/session/restoremanager.cpp @@ -26,7 +26,7 @@ static const int restoreDataVersion = 2; bool RestoreData::isValid() const { - for (const BrowserWindow::SavedWindow &window : qAsConst(windows)) { + for (const BrowserWindow::SavedWindow &window : std::as_const(windows)) { if (!window.isValid()) { return false; } @@ -44,7 +44,7 @@ void RestoreData::clear() QDataStream &operator<<(QDataStream &stream, const RestoreData &data) { stream << data.windows.count(); - for (const BrowserWindow::SavedWindow &window : qAsConst(data.windows)) { + for (const BrowserWindow::SavedWindow &window : std::as_const(data.windows)) { stream << window; } diff --git a/src/lib/sidebar/sidebar.cpp b/src/lib/sidebar/sidebar.cpp index 593ae8345..bc1332dbc 100644 --- a/src/lib/sidebar/sidebar.cpp +++ b/src/lib/sidebar/sidebar.cpp @@ -119,7 +119,7 @@ void SideBarManager::createMenu(QMenu* menu) act->setChecked(m_activeBar == QL1S("History")); group->addAction(act); - for (const QPointer &sidebar : qAsConst(s_sidebars)) { + for (const QPointer &sidebar : std::as_const(s_sidebars)) { if (sidebar) { QAction* act = sidebar.data()->createMenuAction(); act->setData(s_sidebars.key(sidebar)); diff --git a/src/lib/tabwidget/tabtreemodel.cpp b/src/lib/tabwidget/tabtreemodel.cpp index 6dbc9ed3b..77894cb6c 100644 --- a/src/lib/tabwidget/tabtreemodel.cpp +++ b/src/lib/tabwidget/tabtreemodel.cpp @@ -47,7 +47,7 @@ TabTreeModelItem::TabTreeModelItem(WebTab *tab, const QModelIndex &index) TabTreeModelItem::~TabTreeModelItem() { - for (TabTreeModelItem *child : qAsConst(children)) { + for (TabTreeModelItem *child : std::as_const(children)) { delete child; } } @@ -269,7 +269,7 @@ void TabTreeModel::init() } } - for (TabTreeModelItem *item : qAsConst(m_items)) { + for (TabTreeModelItem *item : std::as_const(m_items)) { connectTab(item->tab); } diff --git a/src/lib/tabwidget/tabwidget.cpp b/src/lib/tabwidget/tabwidget.cpp index cc765516c..53a1634a6 100644 --- a/src/lib/tabwidget/tabwidget.cpp +++ b/src/lib/tabwidget/tabwidget.cpp @@ -864,7 +864,7 @@ bool TabWidget::restoreState(const QVector &tabs, int currentT } } - for (const auto &p : qAsConst(childTabs)) { + for (const auto &p : std::as_const(childTabs)) { const auto indices = p.second; for (int index : indices) { WebTab *t = weTab(index); diff --git a/src/lib/tools/buttonwithmenu.cpp b/src/lib/tools/buttonwithmenu.cpp index 6df3ae16f..498768754 100644 --- a/src/lib/tools/buttonwithmenu.cpp +++ b/src/lib/tools/buttonwithmenu.cpp @@ -158,7 +158,7 @@ void ButtonWithMenu::generateMenu() { m_menu->clear(); - for (const Item &item : qAsConst(m_items)) { + for (const Item &item : std::as_const(m_items)) { QVariant variant; variant.setValue(item); m_menu->addAction(item.icon, item.text, this, SLOT(setCurrentItem()))->setData(variant); diff --git a/src/lib/tools/iconprovider.cpp b/src/lib/tools/iconprovider.cpp index baf01ef59..262df4f81 100644 --- a/src/lib/tools/iconprovider.cpp +++ b/src/lib/tools/iconprovider.cpp @@ -257,7 +257,7 @@ void IconProvider::saveIconsToDatabase() { QMutexLocker locker(&instance()->m_iconCacheMutex); - for (const BufferedIcon &ic : qAsConst(m_iconBuffer)) { + for (const BufferedIcon &ic : std::as_const(m_iconBuffer)) { QByteArray ba; QBuffer buffer(&ba); buffer.open(QIODevice::WriteOnly); diff --git a/src/plugins/FlashCookieManager/fcm_plugin.cpp b/src/plugins/FlashCookieManager/fcm_plugin.cpp index 9313dbea0..de4488142 100644 --- a/src/plugins/FlashCookieManager/fcm_plugin.cpp +++ b/src/plugins/FlashCookieManager/fcm_plugin.cpp @@ -171,7 +171,7 @@ bool FCM_Plugin::isWhitelisted(const FlashCookie &flashCookie) void FCM_Plugin::removeAllButWhitelisted() { - for (const FlashCookie &flashCookie : qAsConst(m_flashCookies)) { + for (const FlashCookie &flashCookie : std::as_const(m_flashCookies)) { if (isWhitelisted(flashCookie)) { continue; } @@ -257,7 +257,7 @@ void FCM_Plugin::autoRefresh() loadFlashCookies(); QStringList newCookieList; - for (const FlashCookie &flashCookie : qAsConst(m_flashCookies)) { + for (const FlashCookie &flashCookie : std::as_const(m_flashCookies)) { if (isBlacklisted(flashCookie)) { removeCookie(flashCookie); continue; @@ -268,7 +268,7 @@ void FCM_Plugin::autoRefresh() } bool newCookie = true; - for (const FlashCookie &oldFlashCookie : qAsConst(oldflashCookies)) { + for (const FlashCookie &oldFlashCookie : std::as_const(oldflashCookies)) { if (QString(oldFlashCookie.path + oldFlashCookie.name) == QString(flashCookie.path + flashCookie.name)) { newCookie = false; @@ -378,7 +378,7 @@ void FCM_Plugin::loadFlashCookies(QString path) entryList.removeAll(QL1S(".")); entryList.removeAll(QL1S("..")); - for (QString entry : qAsConst(entryList)) { + for (QString entry : std::as_const(entryList)) { if (path.endsWith(QL1S("#SharedObjects")) && entry == QL1S("#AppContainer")) { // specific to IE and Windows continue; diff --git a/src/plugins/GreaseMonkey/gm_manager.cpp b/src/plugins/GreaseMonkey/gm_manager.cpp index 09b5f46d0..59dea6644 100644 --- a/src/plugins/GreaseMonkey/gm_manager.cpp +++ b/src/plugins/GreaseMonkey/gm_manager.cpp @@ -158,7 +158,7 @@ QList GM_Manager::allScripts() const bool GM_Manager::containsScript(const QString &fullName) const { - for (GM_Script* script : qAsConst(m_scripts)) { + for (GM_Script* script : std::as_const(m_scripts)) { if (fullName == script->fullName()) { return true; } diff --git a/src/plugins/GreaseMonkey/gm_script.cpp b/src/plugins/GreaseMonkey/gm_script.cpp index 6cd4e4876..713cab170 100644 --- a/src/plugins/GreaseMonkey/gm_script.cpp +++ b/src/plugins/GreaseMonkey/gm_script.cpp @@ -333,7 +333,7 @@ void GM_Script::downloadIcon() void GM_Script::downloadRequires() { - for (const QString &url : qAsConst(m_require)) { + for (const QString &url : std::as_const(m_require)) { if (m_manager->requireScripts({url}).isEmpty()) { auto *downloader = new GM_Downloader(QUrl(url), m_manager, GM_Downloader::DownloadRequireScript); connect(downloader, &GM_Downloader::finished, this, &GM_Script::reloadScript); diff --git a/src/plugins/KDEFrameworksIntegration/kdeframeworksintegrationplugin.cpp b/src/plugins/KDEFrameworksIntegration/kdeframeworksintegrationplugin.cpp index a88cbd9cf..7883ad764 100644 --- a/src/plugins/KDEFrameworksIntegration/kdeframeworksintegrationplugin.cpp +++ b/src/plugins/KDEFrameworksIntegration/kdeframeworksintegrationplugin.cpp @@ -128,7 +128,7 @@ void KDEFrameworksIntegrationPlugin::unload() delete m_backend; delete m_sharePageMenu; - for (KIOSchemeHandler *handler : qAsConst(m_kioSchemeHandlers)) { + for (KIOSchemeHandler *handler : std::as_const(m_kioSchemeHandlers)) { mApp->webProfile()->removeUrlSchemeHandler(handler); WebPage::removeSupportedScheme(handler->protocol()); delete handler; diff --git a/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp b/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp index 0b5da37f6..1f1428cfa 100644 --- a/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp +++ b/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp @@ -65,7 +65,7 @@ QVector KWalletPasswordBackend::getEntries(const QUrl &url) QVector list; - for (const PasswordEntry &entry : qAsConst(m_allEntries)) { + for (const PasswordEntry &entry : std::as_const(m_allEntries)) { if (entry.host == host) { list.append(entry); } @@ -269,7 +269,7 @@ void KWalletPasswordBackend::initialize() return; } - for (const PasswordEntry &entry : qAsConst(m_allEntries)) { + for (const PasswordEntry &entry : std::as_const(m_allEntries)) { m_wallet->writeMap(entry.id.toString(), encodeEntry(entry)); } } diff --git a/src/plugins/TabManager/tabmanagerdelegate.cpp b/src/plugins/TabManager/tabmanagerdelegate.cpp index e5556c730..c99f5ca71 100644 --- a/src/plugins/TabManager/tabmanagerdelegate.cpp +++ b/src/plugins/TabManager/tabmanagerdelegate.cpp @@ -189,7 +189,7 @@ void TabManagerDelegate::viewItemDrawText(QPainter *p, const QStyleOptionViewIte // Look for longer parts first std::sort(searchStrings.begin(), searchStrings.end(), sizeBiggerThan); - for (const QString &string : qAsConst(searchStrings)) { + for (const QString &string : std::as_const(searchStrings)) { int delimiter = text.indexOf(string, 0, Qt::CaseInsensitive); while (delimiter != -1) { diff --git a/src/plugins/VerticalTabs/tabtreeview.cpp b/src/plugins/VerticalTabs/tabtreeview.cpp index e7e692d14..9fd69622d 100644 --- a/src/plugins/VerticalTabs/tabtreeview.cpp +++ b/src/plugins/VerticalTabs/tabtreeview.cpp @@ -184,7 +184,7 @@ void TabTreeView::rowsInserted(const QModelIndex &parent, int start, int end) stack.append(idx); idx = idx.parent(); } while (idx.isValid()); - for (const QModelIndex &index : qAsConst(stack)) { + for (const QModelIndex &index : std::as_const(stack)) { expand(index); } if (index.data(TabModel::CurrentTabRole).toBool()) { @@ -415,7 +415,7 @@ void TabTreeView::closeTree(const QModelIndex &root) tabs.append(tab); } }); - for (WebTab *tab : qAsConst(tabs)) { + for (WebTab *tab : std::as_const(tabs)) { tab->closeTab(); } }