blob: e01d7eab035a86e4c79bc88d35c4f7c6425aedcd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
from PySide.QtGui import *
from PySide.QtCore import *
class QtKeyPressListener(QObject):
def __init__(self, obj):
QObject.__init__(self)
obj.installEventFilter(self)
self.fConnections = {}
def eventFilter(self, obj, event):
# This used to crash here due to a misbehaviour of type discovery!
return QObject.eventFilter(self, obj, event)
app = QApplication([])
key_listener = QtKeyPressListener(app)
w = QLabel('Hello')
w.show()
QTimer.singleShot(0, w.close)
app.exec_()
|