On fucking wayland Qt sends us key events with type keypress that are not instances of the QKeyEvent class. Sigh.

This commit is contained in:
Kovid Goyal 2024-12-17 12:30:41 +05:30
parent 4a3994fefd
commit ca223c7f0c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -20,6 +20,7 @@ from qt.core import (
QIcon,
QItemSelectionModel,
QKeyCombination,
QKeyEvent,
QKeySequence,
QLabel,
QMenu,
@ -519,7 +520,7 @@ class Editor(QFrame): # {{{
if t == QEvent.Type.ShortcutOverride:
event.accept()
return True
if t == QEvent.Type.KeyPress:
if t == QEvent.Type.KeyPress and isinstance(event, QKeyEvent):
self.key_press_event(event, 1 if obj is self.button1 else 2)
return True
return QFrame.eventFilter(self, obj, event)