This is what I have, I only have problem with ENTER and SPACE of the keys I have tried.

Qt Code:
  1. void GM_QtWindow::keyPressEvent( QKeyEvent *k )
  2. {
  3. paintGL();
  4. unsigned char key = k->ascii();
  5.  
  6. if(key !=0)
  7. {
  8. _keyboard(key,0,0);
  9. }
  10. else
  11. {
  12. int speckey = k->key();
  13.  
  14. switch(speckey)
  15. {
  16. case Key_A:
  17. _keyboard('a',0,0);
  18. break;
  19. case Key_Up:
  20. _specKeyboard(GM_KEY_UP,0,0);
  21. break;
  22. case Key_Down:
  23. _specKeyboard(GM_KEY_DOWN,0,0);
  24. break;
  25. case Key_Left:
  26. _specKeyboard(GM_KEY_LEFT,0,0);
  27. break;
  28. case Key_Right:
  29. _specKeyboard(GM_KEY_RIGHT,0,0);
  30. break;
  31. case Key_PageUp:
  32. _specKeyboard(GM_KEY_PAGE_UP,0,0);
  33. break;
  34. case Key_PageDown:
  35. _specKeyboard(GM_KEY_PAGE_DOWN,0,0);
  36. break;
  37. case Key_Home:
  38. _specKeyboard(GM_KEY_HOME,0,0);
  39. break;
  40. case Key_End:
  41. _specKeyboard(GM_KEY_END,0,0);
  42. break;
  43. case Key_Insert:
  44. _specKeyboard(GM_KEY_INSERT,0,0);
  45. break;
  46. //not working
  47. case Key_Enter:
  48. cout << "PRESSING ENTER\n";
  49. _specKeyboard(GM_KEY_ENTER,0,0);
  50. break;
  51. case Key_Space:
  52. _specKeyboard(GM_KEY_SPACE,0,0);
  53. break;
  54.  
  55. //mod-keys
  56. case Key_Shift:
  57. _setModKey(GM_SHIFT_BUTTON); _message("Shift-button down");
  58. break;
  59. case Key_Control:
  60. _setModKey(GM_CONTROL_BUTTON); _message("Ctrl-button down");
  61. break;
  62. case Key_Alt:
  63. _setModKey(GM_ALT_BUTTON); _message("Alt-button down");
  64. break;
  65.  
  66. default:
  67. break;
  68. }//end switch
  69. }
  70. paintGL();
  71. }
To copy to clipboard, switch view to plain text mode