Commit 7ab3b432 authored by Dmitry Kazakov's avatar Dmitry Kazakov Committed by Halla Rempt
Browse files

Fix a Ctrl+W shortcut conflict

Another action is created by Qt in
QMdiSubWindowPrivate::createSystemMenu(). Since we cannot
remove it, we should just let it work.


BUG:398729
parent 52d9592f
......@@ -2102,6 +2102,25 @@ void KisMainWindow::subWindowActivated()
}
}
/**
* Qt has a weridness, it has a hardcoded shortcut added to an action
* in the window menu. We cannot change or remove it, so we should
* just disable our own shortcut in case it conflicts with the hardcoded
* shortcut.
*/
d->close->setShortcutContext(Qt::WindowShortcut);
QMdiSubWindow *subWindow = d->mdiArea->currentSubWindow();
if (subWindow) {
QMenu *menu = subWindow->systemMenu();
if (menu) {
Q_FOREACH (QAction *action, menu->actions()) {
if (action->shortcut() == d->close->shortcut()) {
d->close->setShortcutContext(Qt::WidgetShortcut);
}
}
}
}
updateCaption();
d->actionManager()->updateGUI();
}
......@@ -2373,8 +2392,10 @@ void KisMainWindow::newWindow()
void KisMainWindow::closeCurrentWindow()
{
d->mdiArea->currentSubWindow()->close();
d->actionManager()->updateGUI();
if (d->mdiArea->currentSubWindow()) {
d->mdiArea->currentSubWindow()->close();
d->actionManager()->updateGUI();
}
}
void KisMainWindow::checkSanity()
......@@ -2559,8 +2580,7 @@ void KisMainWindow::createActions()
d->newWindow = actionManager->createAction("view_newwindow");
connect(d->newWindow, SIGNAL(triggered(bool)), this, SLOT(newWindow()));
d->close = actionManager->createAction("file_close");
connect(d->close, SIGNAL(triggered()), SLOT(closeCurrentWindow()));
d->close = actionManager->createStandardAction(KStandardAction::Close, this, SLOT(closeCurrentWindow()));
d->showSessionManager = actionManager->createAction("file_sessions");
connect(d->showSessionManager, SIGNAL(triggered(bool)), this, SLOT(slotShowSessionManager()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment