Make eventFilter work when mode is None

This commit is contained in:
Florian Bruhin 2014-04-24 21:29:28 +02:00
parent 9320c813f7
commit ea6a25714a

View File

@ -165,8 +165,11 @@ class ModeManager(QObject):
Emit: Emit:
key_pressed: When a key was actually pressed. key_pressed: When a key was actually pressed.
""" """
typ = evt.type() if self.mode is None:
# We got events before mode is set, so just pass them through.
return False
handler = self._handlers[self.mode] handler = self._handlers[self.mode]
typ = evt.type()
if typ not in [QEvent.KeyPress, QEvent.KeyRelease]: if typ not in [QEvent.KeyPress, QEvent.KeyRelease]:
# We're not interested in non-key-events so we pass them through. # We're not interested in non-key-events so we pass them through.
return False return False