You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 20, 2023. It is now read-only.
When pressing the escape key, one would expect the window to close. Currently however, it causes the contents of the window to close, but the window remains open.
I have tried both defining the eventFilter, which picks up keypresses, but not escape, and overriding keyPressEvent, which has the same behaviour as eventFilter.
class Boilerplate(QtWidgets.QMainWindow):
def __init__(self, parent=None):
...
self.installEventFilter(self)
def eventFilter(self, widget, event):
if event.type() == QtCore.QEvent.KeyPress:
print 'press'
if event.key() == QtCore.Qt.Key_Escape:
print 'escape'
return super(Boilerplate, self).eventFilter(widget, event)