Important: Please read the Qt Code of Conduct -

QMessageBox not receiving keyPressEvents

  • Hi, I have subclassed QMessasgebox to add a timer and also an override of the keyPressEvent. There are 2 buttons for accept and retry. The timer and buttons appear to operate correctly but I am not receiving any keyPressEvents. Prior to usage I have created my QApplication but have not called QApplicaion.exec() and have not created a main QWidget. If I instantiate a QWidget my message box starts to receive keyPressEvents. Is a QWidget needed for QMessagbox to receive keyPressEvents? I thought when QMessagebox.exec() was called Qt creates an event queue which would post keyPressEvents? This app uses an older version of Qt 4.7.0 running on an Arm platform, Thanks.

  • @allagar Hi! There are couple of things that might go wrong, please post a minimal example so we don't have to poke around in the dark.

  • Wieland, many thanks for the reply after more investigation this appears to be related to my application and how the keypad is being supported, I have marked this as solved. Thanks again.

Log in to reply