Suppress context menu properly with rocker gestures
For some reason, the event filter stopped inhibiting the context menu with Qt 5.9 (or possibly 5.8). (cherry picked from commit0ed215d81f) Remove unnecessary return (cherry picked from commit8159206576)
This commit is contained in:
parent
8ade7d22f2
commit
05ba5476b9
|
|
@ -116,7 +116,6 @@ class TabEventFilter(QObject):
|
|||
QEvent.MouseButtonPress: self._handle_mouse_press,
|
||||
QEvent.MouseButtonRelease: self._handle_mouse_release,
|
||||
QEvent.Wheel: self._handle_wheel,
|
||||
QEvent.ContextMenu: self._handle_context_menu,
|
||||
QEvent.KeyRelease: self._handle_key_release,
|
||||
}
|
||||
self._ignore_wheel_event = False
|
||||
|
|
@ -210,17 +209,6 @@ class TabEventFilter(QObject):
|
|||
|
||||
return False
|
||||
|
||||
def _handle_context_menu(self, _e):
|
||||
"""Suppress context menus if rocker gestures are turned on.
|
||||
|
||||
Args:
|
||||
e: The QContextMenuEvent.
|
||||
|
||||
Return:
|
||||
True if the event should be filtered, False otherwise.
|
||||
"""
|
||||
return config.val.input.mouse.rocker_gestures
|
||||
|
||||
def _handle_key_release(self, e):
|
||||
"""Ignore repeated key release events going to the website.
|
||||
|
||||
|
|
|
|||
|
|
@ -151,6 +151,13 @@ class WebEngineView(QWebEngineView):
|
|||
tab = shared.get_tab(self._win_id, target)
|
||||
return tab._widget # pylint: disable=protected-access
|
||||
|
||||
def contextMenuEvent(self, ev):
|
||||
"""Prevent context menus when rocker gestures are enabled."""
|
||||
if config.val.input.mouse.rocker_gestures:
|
||||
ev.ignore()
|
||||
return
|
||||
super().contextMenuEvent(ev)
|
||||
|
||||
|
||||
class WebEnginePage(QWebEnginePage):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue