aboutsummaryrefslogtreecommitdiff
path: root/src/browser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/browser.cpp')
-rw-r--r--src/browser.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index 3442d66..4f3f3d7 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -117,14 +117,14 @@ void Browser::setup(const QString &defaultProfile)
m_plugins.append(loadPlugins(QString::fromStdString(m_config->value<std::string>("plugins.path").value())));
// register commands
- for(Plugin p : m_plugins) {
+ for(const Plugin &p : qAsConst(m_plugins)) {
if(p.instance->inherits("ProfileInterface")) {
auto *profileEditor = qobject_cast<ProfileInterface *>(p.instance.get());
Q_ASSERT_X(profileEditor != nullptr, "Browser::setup", "profile interface cast failed");
- for(const QString &name : m_profiles.keys()) {
- profileEditor->addProfile(name, qobject_cast<QWebEngineProfile*>(m_profiles.value(name)));
+ for(auto i = m_profiles.constBegin(); i != m_profiles.constEnd(); ++i) {
+ profileEditor->addProfile(i.key(), qobject_cast<QWebEngineProfile*>(i.value()));
}
}
@@ -228,11 +228,11 @@ MainWindow *Browser::createWindow()
});
window->addAction(MainWindow::ToolsMenu, downloadsAction);
- for(Plugin p : m_plugins) {
- auto *profileEditor = qobject_cast<ProfileInterface *>(p.instance.get());
- if(profileEditor) {
+ for(const Plugin &p : qAsConst(m_plugins)) {
+ if(p.instance->inherits("ProfileInterface")) {
+ auto *profileEditor = qobject_cast<ProfileInterface *>(p.instance.get());
auto *profileAction = new QAction(tr("Profile"), window);
- connect(profileAction, &QAction::triggered, window, [this, profileEditor]() {
+ connect(profileAction, &QAction::triggered, window, [profileEditor]() {
profileEditor->createWidget(nullptr)->show();
});
window->addAction(MainWindow::ToolsMenu, profileAction);