Default focus policy of QWidget (and QMainWindow as well) is NoFocus.
Your widget simply doesn't have focus so it won't receive key events. If you want something to happen on a specific key combination you can register a shortcut for that combination - this is done via QShortcut (of course you still won't receive a keyPressEvent in your widget).
Bookmarks