diff options
Diffstat (limited to 'src/mainwindow')
-rw-r--r-- | src/mainwindow/menubar.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mainwindow/menubar.cpp b/src/mainwindow/menubar.cpp index 76e08c6..7fdad24 100644 --- a/src/mainwindow/menubar.cpp +++ b/src/mainwindow/menubar.cpp @@ -508,12 +508,7 @@ QAction *MenuBar::insertPlugin(QMenu *menu) void MenuBar::insertSubWindow(SubWindow *subwindow) { - auto *action = window->addAction(subwindow->windowTitle(), subwindow, [subwindow]() { - if(!subwindow->windowState().testFlag(Qt::WindowMaximized)) - subwindow->showMaximized(); - else - subwindow->showNormal(); - }); + auto *action = window->addAction(subwindow->windowTitle()); action->setCheckable(true); connect(subwindow, &SubWindow::windowStateChanged, action, [action](Qt::WindowStates, Qt::WindowStates state) { @@ -522,4 +517,16 @@ void MenuBar::insertSubWindow(SubWindow *subwindow) connect(subwindow, &SubWindow::windowTitleChanged, action, &QAction::setText); connect(subwindow, &SubWindow::destroyed, action, &QAction::deleteLater); + + auto *optionsMenu = new QMenu; + optionsMenu->addAction(tr("Switch to"), subwindow, [subwindow]() { + if(!subwindow->windowState().testFlag(Qt::WindowMaximized)) + subwindow->showMaximized(); + else + subwindow->showNormal(); + }); + optionsMenu->addAction(tr("Close"), subwindow, [subwindow]() { + subwindow->close(); + }); + action->setMenu(optionsMenu); } |