blob: 8c4cd90dbd543b89b9213926d791dcf1b974d581 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
from PySide.QtGui import *
from PySide.QtCore import *
class QtKeyPressListener(QObject):
def __init__(self, obj):
QObject.__init__(self)
obj.installEventFilter(self)
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_()
|