You can always override keyPressEvent() and call the base class implementation only if certain condition is fulfilled.