diff options
| author | Eugene Popov <[email protected]> | 2023-04-25 13:05:39 +0000 |
|---|---|---|
| committer | Felix Ernst <[email protected]> | 2023-04-25 13:05:39 +0000 |
| commit | 7b6a67e520c04f56b4b05fa26b252177398df6df (patch) | |
| tree | 2932c1185b4fbd123327ff8d42afc0671bbce1ed /src/dolphinmainwindow.cpp | |
| parent | f186f694d4613c335184feed89e50f345c72f47c (diff) | |
Fix activating the Selection Mode with a keyboard shortcut
If a spacebar is used as a keyboard shortcut to activate the Selection Mode, then allow this shortcut to be triggered only if the view has a keyboard focus.
BUG: 465489
Diffstat (limited to 'src/dolphinmainwindow.cpp')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 7931bab58..0094bc2e7 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -547,6 +547,19 @@ void DolphinMainWindow::showTarget() }); } +bool DolphinMainWindow::event(QEvent *event) +{ + if (event->type() == QEvent::ShortcutOverride) { + const QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); + if (keyEvent->key() == Qt::Key_Space && m_activeViewContainer->view()->handleSpaceAsNormalKey()) { + event->accept(); + return true; + } + } + + return KXmlGuiWindow::event(event); +} + void DolphinMainWindow::showEvent(QShowEvent *event) { KXmlGuiWindow::showEvent(event); @@ -1722,6 +1735,7 @@ void DolphinMainWindow::setupActions() "</para>")); toggleSelectionModeAction->setIcon(QIcon::fromTheme(QStringLiteral("quickwizard"))); toggleSelectionModeAction->setCheckable(true); + actionCollection()->setDefaultShortcut(toggleSelectionModeAction, Qt::Key_Space ); connect(toggleSelectionModeAction, &QAction::triggered, this, &DolphinMainWindow::toggleSelectionMode); // A special version of the toggleSelectionModeAction for the toolbar that also contains a menu |
