I have a basic question about Qt and Mac OS X. If I define a QMainWindow
class and define a keyPressEvent
function as below, is it not supposed to enter this function whenever a key is pressed anywhere in the MyWindow
? I have some problems with it under Linux, where I do not get the keypress events if certain widgets were focused on (list views or edit boxes), but at least I get it if I focus on a button and then press a key. Under Mac OS X I do not get any response at all.
class MyWindow(QMainWindow):
def keyPressEvent(self, event):
key = event.key()
if key == Qt.Key_F:
print("pressed F key")
Any ideas (using Python with PySide)?