mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +00:00
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.
This commit is contained in:
parent
dfbd432d3f
commit
f38d788a97
|
@ -269,7 +269,7 @@ void DolphinStatusBar::contextMenuEvent(QContextMenuEvent *event)
|
||||||
showSpaceInfoAction->setCheckable(true);
|
showSpaceInfoAction->setCheckable(true);
|
||||||
showSpaceInfoAction->setChecked(GeneralSettings::showSpaceInfo());
|
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) {
|
if (action == showZoomSliderAction) {
|
||||||
const bool visible = showZoomSliderAction->isChecked();
|
const bool visible = showZoomSliderAction->isChecked();
|
||||||
GeneralSettings::setShowZoomSlider(visible);
|
GeneralSettings::setShowZoomSlider(visible);
|
||||||
|
|
Loading…
Reference in a new issue