diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-10-04 19:42:46 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-10-04 19:42:46 +0200 |
commit | 5563bb3c94f9c001f95de44a5818d2f86631532b (patch) | |
tree | 2b9fe955e14b167c64251677533ee4d0f34006eb /src/mainwindow | |
parent | Update pkgbuild to use asciidoctor (diff) | |
download | smolbote-5563bb3c94f9c001f95de44a5818d2f86631532b.tar.xz |
clazy: fix warnings
Diffstat (limited to 'src/mainwindow')
-rw-r--r-- | src/mainwindow/mainwindow.cpp | 16 | ||||
-rw-r--r-- | src/mainwindow/widgets/navigationbar.cpp | 6 |
2 files changed, 8 insertions, 14 deletions
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index 8a33e23..b3a7722 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -89,16 +89,6 @@ MainWindow::MainWindow(const std::unique_ptr<Configuration> &config, QWidget *pa } show(); -#ifdef QT_DEBUG - { - auto *debugMenu = ui->menubar->addMenu(tr("Debug")); - - debugMenu->addAction(tr("Crash"), []() { - delete reinterpret_cast<QString*>(0xFEE1DEAD); - }); - }; -#endif - // connect smolbote menu { connect(ui->actionNewSubwindow, &QAction::triggered, this, [this, &config]() { @@ -293,7 +283,8 @@ void MainWindow::addAction(ActionLocation where, QAction *action) void MainWindow::addDockWidget(Qt::DockWidgetArea area, QWidget *widget) { QDockWidget *lastDock = nullptr; - for(QDockWidget *dock : findChildren<QDockWidget *>()) { + const auto docks = findChildren<QDockWidget *>(); + for(QDockWidget *dock : docks) { if(dockWidgetArea(dock) == area) lastDock = dock; } @@ -334,7 +325,8 @@ void MainWindow::createTab(const QUrl &url) const QVector<SubWindow *> MainWindow::subWindows() const { QVector<SubWindow *> list; - for(auto *w : mdiArea->subWindowList()) { + const auto subwindows = mdiArea->subWindowList(); + for(auto *w : subwindows) { auto *subwindow = qobject_cast<SubWindow *>(w); if(subwindow != nullptr) list.append(subwindow); diff --git a/src/mainwindow/widgets/navigationbar.cpp b/src/mainwindow/widgets/navigationbar.cpp index e179565..b49680d 100644 --- a/src/mainwindow/widgets/navigationbar.cpp +++ b/src/mainwindow/widgets/navigationbar.cpp @@ -36,7 +36,8 @@ NavigationBar::NavigationBar(const QHash<QString, QString> &conf, QWidget *paren auto *backMenu = new QMenu(this); connect(backMenu, &QMenu::aboutToShow, this, [this, backMenu]() { backMenu->clear(); - for(const QWebEngineHistoryItem &item : m_view->history()->backItems(10)) { + const auto history = m_view->history()->backItems(10); + for(const QWebEngineHistoryItem &item : history) { auto *action = backMenu->addAction(item.title()); connect(action, &QAction::triggered, this, [item, this]() { m_view->history()->goToItem(item); @@ -66,7 +67,8 @@ NavigationBar::NavigationBar(const QHash<QString, QString> &conf, QWidget *paren auto *forwardMenu = new QMenu(this); connect(forwardMenu, &QMenu::aboutToShow, this, [this, forwardMenu]() { forwardMenu->clear(); - for(const QWebEngineHistoryItem &item : m_view->history()->forwardItems(10)) { + const auto history = m_view->history()->forwardItems(10); + for(const QWebEngineHistoryItem &item : history) { auto *action = forwardMenu->addAction(item.title()); connect(action, &QAction::triggered, this, [item, this]() { m_view->history()->goToItem(item); |