From 3e6bed362176dfa53dbaa082e2b0be45bd7cf087 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sat, 6 Oct 2018 15:40:25 +0200 Subject: Add "subwindow.shortcuts.menu" shortcut --- src/mainwindow/mainwindow.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index b3a7722..cabc94b 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -183,6 +183,19 @@ MainWindow::MainWindow(const std::unique_ptr &config, QWidget *pa connect(pageLoadProfileMenu, &QMenu::aboutToShow, this, &MainWindow::updatePageLoadProfileMenu); } + // current subwindow shortcut + { + QAction *subwindowMenuAction = new QAction(this); + QMainWindow::addAction(subwindowMenuAction); + config->setShortcut(subwindowMenuAction, "subwindow.shortcuts.menu"); + connect(subwindowMenuAction, &QAction::triggered, this, [this]() { + QMdiSubWindow *window = mdiArea->currentSubWindow(); + if(window) { + window->systemMenu()->exec(); + } + }); + } + navigationToolBar = new NavigationBar(config->section("navigation"), this); navigationToolBar->setMovable(config->value("navigation.movable").value()); addToolBar(Qt::TopToolBarArea, navigationToolBar); @@ -313,11 +326,7 @@ void MainWindow::removeDockWidget(QWidget *widget) void MainWindow::createTab(const QUrl &url) { auto *w = qobject_cast(mdiArea->currentSubWindow()); - if(w == nullptr) { - //w = createSubWindow(url.toString()); - // w = createSubWindow(WebProfile::defaultProfile()); - // w->addTab(url); - } else { + if(w != nullptr) { w->addTab(url); } } -- cgit v1.2.1