Git commit 97a2f5bf845587d1c8ab41d7f489d28b69b8e3fa by Alexander Semke. Committed on 22/09/2018 at 16:58. Pushed by asemke into branch 'master'. 1. avoid collisions for the QKeySequence::Close shortcut 2. added default shortcuts for next and previous window actions M +13 -1 src/kdefrontend/MainWin.cpp https://commits.kde.org/labplot/97a2f5bf845587d1c8ab41d7f489d28b69b8e3fa diff --git a/src/kdefrontend/MainWin.cpp b/src/kdefrontend/MainWin.cpp index bd1baecf..d4de5870 100644 --- a/src/kdefrontend/MainWin.cpp +++ b/src/kdefrontend/MainWin.cpp @@ -335,6 +335,7 @@ void MainWin::initActions() { KStandardAction::open(this, SLOT(openProject()),actionCollection()); m_recentProjectsAction =3D KStandardAction::openRecent(this, SLOT(openRec= entProject(QUrl)),actionCollection()); m_closeAction =3D KStandardAction::close(this, SLOT(closeProject()),actio= nCollection()); + actionCollection()->setDefaultShortcut(m_closeAction, QKeySequence()); //= remove the shortcut, QKeySequence::Close will be used for closing sub-windo= ws m_saveAction =3D KStandardAction::save(this, SLOT(saveProject()),actionCo= llection()); m_saveAsAction =3D KStandardAction::saveAs(this, SLOT(saveProjectAs()),ac= tionCollection()); m_printAction =3D KStandardAction::print(this, SLOT(print()),actionCollec= tion()); @@ -428,7 +429,7 @@ void MainWin::initActions() { = //Windows QAction* action =3D new QAction(i18n("&Close"), this); - actionCollection()->setDefaultShortcut(action, Qt::CTRL+Qt::Key_U); + actionCollection()->setDefaultShortcut(action, QKeySequence::Close); action->setStatusTip(i18n("Close the active window")); actionCollection()->addAction("close window", action); connect(action, SIGNAL(triggered()), m_mdiArea, SLOT(closeActiveSubWindow= ())); @@ -448,11 +449,13 @@ void MainWin::initActions() { actionCollection()->addAction("cascade windows", m_cascadeWindows); connect(m_cascadeWindows, SIGNAL(triggered()), m_mdiArea, SLOT(cascadeSub= Windows())); action =3D new QAction(QIcon::fromTheme("go-next-view"), i18n("Ne&xt"), t= his); + actionCollection()->setDefaultShortcut(action, QKeySequence::NextChild); action->setStatusTip(i18n("Move the focus to the next window")); actionCollection()->addAction("next window", action); connect(action, SIGNAL(triggered()), m_mdiArea, SLOT(activateNextSubWindo= w())); = action =3D new QAction(QIcon::fromTheme("go-previous-view"), i18n("Pre&vi= ous"), this); + actionCollection()->setDefaultShortcut(action, QKeySequence::PreviousChil= d); action->setStatusTip(i18n("Move the focus to the previous window")); actionCollection()->addAction("previous window", action); connect(action, SIGNAL(triggered()), m_mdiArea, SLOT(activatePreviousSubW= indow())); @@ -1508,6 +1511,15 @@ void MainWin::activateSubWindowForAspect(const Abstr= actAspect* aspect) const { else m_mdiArea->addSubWindow(win); win->show(); + + //Qt provides its own "system menu" for every sub-window. The shortcut = for the close-action + //in this menu collides with our global m_closeAction. + //remove the shortcuts in the system menu to avoid this collision. + QMenu* menu =3D win->systemMenu(); + if (menu) { + for (QAction* action : menu->actions()) + action->setShortcut(QKeySequence()); + } } m_mdiArea->setActiveSubWindow(win); } else {