Does any one know how to setup Key press event handeling?

i can make head nor tail of the online docs on this issue and i just want to setup the escape button to trigger a function when pressed viewing the main window.

do i have to add a method to the object of the mainwindow class to catch it or something?

i just can see any examples on this at all (or any that make sense)


your help on this would be much appreciated