┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/statusbar
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2023-10-16 16:50:07 +0200
committerFelix Ernst <[email protected]>2023-10-18 08:27:27 +0000
commitf38d788a97fe195e3257bccdd351162bd14c1ac9 (patch)
tree10fc4d4297d1363af926670c34d5a6ed4c42c288 /src/statusbar
parentdfbd432d3fc763e5fac75e4d9ded3e89572115e4 (diff)
Never show status bar context menu away from status bar
The status bar context menu was hard-coded to always appear at the cursor position. However, context menus can also be triggered by keyboard, for example with the Menu key, in which case it makes no sense to show the context menu at whatever random position the mouse cursor currently is. Instead invoke the context menu in the middle of the status bar when it is opened by keyboard.
Diffstat (limited to 'src/statusbar')
-rw-r--r--src/statusbar/dolphinstatusbar.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/statusbar/dolphinstatusbar.cpp b/src/statusbar/dolphinstatusbar.cpp
index 9c101b3fa..9830960dc 100644
--- a/src/statusbar/dolphinstatusbar.cpp
+++ b/src/statusbar/dolphinstatusbar.cpp
@@ -269,7 +269,7 @@ void DolphinStatusBar::contextMenuEvent(QContextMenuEvent *event)
showSpaceInfoAction->setCheckable(true);
showSpaceInfoAction->setChecked(GeneralSettings::showSpaceInfo());
- const QAction *action = menu.exec(QCursor::pos());
+ const QAction *action = menu.exec(event->reason() == QContextMenuEvent::Reason::Mouse ? QCursor::pos() : mapToGlobal(QPoint(width() / 2, height() / 2)));
if (action == showZoomSliderAction) {
const bool visible = showZoomSliderAction->isChecked();
GeneralSettings::setShowZoomSlider(visible);