Confused about keypress event
-
Hi,
Im using pyside, and I am loading a ui file from designer with QUiLoader.@class MyWidget(QtGui.QMainWindow):
def init(self, *args):
apply(QtGui.QMainWindow.init, (self,) + args)loader = QtUiTools.QUiLoader()
file = QtCore.QFile("pyside_demo.ui")
file.open(QtCore.QFile.ReadOnly)
self.ui = loader.load(file, self)
file.close()def keyPressEvent(self, e):
print "a key was pressed"
if e.key() == QtCore.Qt.Key_Escape:
print "escape was pressed"def show(self):
self.ui.show()@I dont really know how to get the keypress event to work - at the moment it does not - any clues?