Hi all,

I'm working on a QtWidgets (Qt 5.11) based Desktop Application on Mac OS.

The MainWindow creates a custom QWidget that reimplements keyPressEvent:

Qt Code:
  1. void QuickInterface::keyPressEvent(QKeyEvent *event)
  2. {
  3. if(event->key() == Qt::Key_Up)
  4. {
  5. qDebug() << "Up pressed";
  6. emit editorSelected();
  7. }
  8. else if(event->key() == Qt::Key_Down)
  9. {
  10. qDebug() << "Down pressed";
  11. }
  12. else if(event->key() == Qt::Key_Left)
  13. {
  14. qDebug() << "Left pressed";
  15. }
  16. else if(event->key() == Qt::Key_Right)
  17. {
  18. qDebug() << "Right pressed";
  19. }
  20. else if(event->key() == Qt::Key_Escape)
  21. {
  22. qDebug() << "Escape pressed";
  23. }
  24. }
To copy to clipboard, switch view to plain text mode 

The code is working as expected unless the MainWindow is minimized to the tray. Although the widget is still showing normal and has Focus and the qApplication is the currently active Desktop Application the KeyEvents are being ignored.

Any ideas on what I could be missing? I don't understand the reason for this dependency. Can I change this behavior somehow, maybe by reimplementing the showMinimized() Slot of QMainWindow?