In my main application window (QMainWindow), I am capturing the keyPressEvent for all the Function keys. I am successfully capturing F1, F3-F12, but F2 will not cause a keyPressEvent. I have looked throughout my main window code and I am not using F2 for any other shortcut that I know of. The thing that really has me puzzled is that I am creating a second QMainWindow and capturing the F1-F12 keyPressEvents without any problem. Is there some default shortcut that uses F2 that I am missing? I have ensured that I am using accept( )/ignore( ) throughout the press event.

Qt Code:
  1. void MainWindow::keyPressEvent( QKeyEvent *event )
  2. {
  3. //This line will print for every key other than F2
  4. fprintf( stderr, "In MainWindow::keyPressEvent( QKeyEvent *event )" );
  5.  
  6. QString keySequence = "";
  7.  
  8. if( event->state( ) & Qt::ControlButton )
  9. {
  10. keySequence += tr( "Ctrl+" );
  11. }
  12. if( event->state( ) & Qt::ShiftButton )
  13. {
  14. keySequence += tr( "Shift+" );
  15. }
  16. if( event->state( ) & Qt::AltButton )
  17. {
  18. keySequence += tr( "Alt+" );
  19. }
  20. if( event->state( ) & Qt::MetaButton )
  21. {
  22. keySequence += tr( "Meta+" );
  23. }
  24.  
  25. if( event->key( ) != Qt::Key_Control &&
  26. event->key( ) != Qt::Key_Shift &&
  27. event->key( ) != Qt::Key_Meta &&
  28. event->key( ) != Qt::Key_Alt )
  29. {
  30. ... continue building the keySequence and check against configuration file
  31. }
  32.  
  33. event->ignore( );
To copy to clipboard, switch view to plain text mode