void GM_QtWindow
::keyPressEvent( QKeyEvent *k
) {
paintGL();
unsigned char key = k->ascii();
if(key !=0)
{
_keyboard(key,0,0);
}
else
{
int speckey = k->key();
switch(speckey)
{
case Key_A:
_keyboard('a',0,0);
break;
case Key_Up:
_specKeyboard(GM_KEY_UP,0,0);
break;
case Key_Down:
_specKeyboard(GM_KEY_DOWN,0,0);
break;
case Key_Left:
_specKeyboard(GM_KEY_LEFT,0,0);
break;
case Key_Right:
_specKeyboard(GM_KEY_RIGHT,0,0);
break;
case Key_PageUp:
_specKeyboard(GM_KEY_PAGE_UP,0,0);
break;
case Key_PageDown:
_specKeyboard(GM_KEY_PAGE_DOWN,0,0);
break;
case Key_Home:
_specKeyboard(GM_KEY_HOME,0,0);
break;
case Key_End:
_specKeyboard(GM_KEY_END,0,0);
break;
case Key_Insert:
_specKeyboard(GM_KEY_INSERT,0,0);
break;
//not working
case Key_Enter:
cout << "PRESSING ENTER\n";
_specKeyboard(GM_KEY_ENTER,0,0);
break;
case Key_Space:
_specKeyboard(GM_KEY_SPACE,0,0);
break;
//mod-keys
case Key_Shift:
_setModKey(GM_SHIFT_BUTTON); _message("Shift-button down");
break;
case Key_Control:
_setModKey(GM_CONTROL_BUTTON); _message("Ctrl-button down");
break;
case Key_Alt:
_setModKey(GM_ALT_BUTTON); _message("Alt-button down");
break;
default:
break;
}//end switch
}
paintGL();
}
void GM_QtWindow::keyPressEvent( QKeyEvent *k )
{
paintGL();
unsigned char key = k->ascii();
if(key !=0)
{
_keyboard(key,0,0);
}
else
{
int speckey = k->key();
switch(speckey)
{
case Key_A:
_keyboard('a',0,0);
break;
case Key_Up:
_specKeyboard(GM_KEY_UP,0,0);
break;
case Key_Down:
_specKeyboard(GM_KEY_DOWN,0,0);
break;
case Key_Left:
_specKeyboard(GM_KEY_LEFT,0,0);
break;
case Key_Right:
_specKeyboard(GM_KEY_RIGHT,0,0);
break;
case Key_PageUp:
_specKeyboard(GM_KEY_PAGE_UP,0,0);
break;
case Key_PageDown:
_specKeyboard(GM_KEY_PAGE_DOWN,0,0);
break;
case Key_Home:
_specKeyboard(GM_KEY_HOME,0,0);
break;
case Key_End:
_specKeyboard(GM_KEY_END,0,0);
break;
case Key_Insert:
_specKeyboard(GM_KEY_INSERT,0,0);
break;
//not working
case Key_Enter:
cout << "PRESSING ENTER\n";
_specKeyboard(GM_KEY_ENTER,0,0);
break;
case Key_Space:
_specKeyboard(GM_KEY_SPACE,0,0);
break;
//mod-keys
case Key_Shift:
_setModKey(GM_SHIFT_BUTTON); _message("Shift-button down");
break;
case Key_Control:
_setModKey(GM_CONTROL_BUTTON); _message("Ctrl-button down");
break;
case Key_Alt:
_setModKey(GM_ALT_BUTTON); _message("Alt-button down");
break;
default:
break;
}//end switch
}
paintGL();
}
To copy to clipboard, switch view to plain text mode
Bookmarks