Skip to content

Work around conflicting shortcuts in preview plugin

Christoph Roick requested to merge croick/kate:preview-shortcut into master

Do not let shortcuts issued within a preview widget propagate to the application's shortcut event handler. Instead handle the event while it's still a ShortcutOverride event to prevent the detection of seemingly ambiguous shortcuts. Also do not let actions defined inside the preview KPart capture shortcuts that are handled on the application level.

Before the Shortcut event is emitted by the action, a ShortcutOverride event is emitted by the focussed widget and propagated to it's parents until it gets handled. The ShortcutOverride event can be casted to a QKeyEvent, which contains the pressed keys. If we accept the ShortcutOverride event, the Shortcut event is never emitted and no ambiguity is detected.
Shortcut events are handled by the application, so we could only catch "our" Shortcut event by filtering all application events (done so in KXMLGUI's KActionConflictDetector) and matching the object to the actions we know. This would introduce more overhead than proposed in this MR.

BUG: 386265
BUG: 407869

Merge request reports