17 #ifndef GEPETTO_GUI_QT_OSG_KEYBOARD_HH__ 18 # define GEPETTO_GUI_QT_OSG_KEYBOARD_HH__ 30 mKeyMap[Qt::Key_Escape ] = osgGA::GUIEventAdapter::KEY_Escape;
31 mKeyMap[Qt::Key_Delete ] = osgGA::GUIEventAdapter::KEY_Delete;
32 mKeyMap[Qt::Key_Home ] = osgGA::GUIEventAdapter::KEY_Home;
33 mKeyMap[Qt::Key_Enter ] = osgGA::GUIEventAdapter::KEY_KP_Enter;
34 mKeyMap[Qt::Key_End ] = osgGA::GUIEventAdapter::KEY_End;
35 mKeyMap[Qt::Key_Return ] = osgGA::GUIEventAdapter::KEY_Return;
36 mKeyMap[Qt::Key_PageUp ] = osgGA::GUIEventAdapter::KEY_Page_Up;
37 mKeyMap[Qt::Key_PageDown ] = osgGA::GUIEventAdapter::KEY_Page_Down;
38 mKeyMap[Qt::Key_Left ] = osgGA::GUIEventAdapter::KEY_Left;
39 mKeyMap[Qt::Key_Right ] = osgGA::GUIEventAdapter::KEY_Right;
40 mKeyMap[Qt::Key_Up ] = osgGA::GUIEventAdapter::KEY_Up;
41 mKeyMap[Qt::Key_Down ] = osgGA::GUIEventAdapter::KEY_Down;
42 mKeyMap[Qt::Key_Backspace ] = osgGA::GUIEventAdapter::KEY_BackSpace;
43 mKeyMap[Qt::Key_Tab ] = osgGA::GUIEventAdapter::KEY_Tab;
44 mKeyMap[Qt::Key_Space ] = osgGA::GUIEventAdapter::KEY_Space;
45 mKeyMap[Qt::Key_Delete ] = osgGA::GUIEventAdapter::KEY_Delete;
46 mKeyMap[Qt::Key_Alt ] = osgGA::GUIEventAdapter::KEY_Alt_L;
47 mKeyMap[Qt::Key_Shift ] = osgGA::GUIEventAdapter::KEY_Shift_L;
48 mKeyMap[Qt::Key_Control ] = osgGA::GUIEventAdapter::KEY_Control_L;
49 mKeyMap[Qt::Key_Meta ] = osgGA::GUIEventAdapter::KEY_Meta_L;
51 mKeyMap[Qt::Key_F1 ] = osgGA::GUIEventAdapter::KEY_F1;
52 mKeyMap[Qt::Key_F2 ] = osgGA::GUIEventAdapter::KEY_F2;
53 mKeyMap[Qt::Key_F3 ] = osgGA::GUIEventAdapter::KEY_F3;
54 mKeyMap[Qt::Key_F4 ] = osgGA::GUIEventAdapter::KEY_F4;
55 mKeyMap[Qt::Key_F5 ] = osgGA::GUIEventAdapter::KEY_F5;
56 mKeyMap[Qt::Key_F6 ] = osgGA::GUIEventAdapter::KEY_F6;
57 mKeyMap[Qt::Key_F7 ] = osgGA::GUIEventAdapter::KEY_F7;
58 mKeyMap[Qt::Key_F8 ] = osgGA::GUIEventAdapter::KEY_F8;
59 mKeyMap[Qt::Key_F9 ] = osgGA::GUIEventAdapter::KEY_F9;
60 mKeyMap[Qt::Key_F10 ] = osgGA::GUIEventAdapter::KEY_F10;
61 mKeyMap[Qt::Key_F11 ] = osgGA::GUIEventAdapter::KEY_F11;
62 mKeyMap[Qt::Key_F12 ] = osgGA::GUIEventAdapter::KEY_F12;
63 mKeyMap[Qt::Key_F13 ] = osgGA::GUIEventAdapter::KEY_F13;
64 mKeyMap[Qt::Key_F14 ] = osgGA::GUIEventAdapter::KEY_F14;
65 mKeyMap[Qt::Key_F15 ] = osgGA::GUIEventAdapter::KEY_F15;
66 mKeyMap[Qt::Key_F16 ] = osgGA::GUIEventAdapter::KEY_F16;
67 mKeyMap[Qt::Key_F17 ] = osgGA::GUIEventAdapter::KEY_F17;
68 mKeyMap[Qt::Key_F18 ] = osgGA::GUIEventAdapter::KEY_F18;
69 mKeyMap[Qt::Key_F19 ] = osgGA::GUIEventAdapter::KEY_F19;
70 mKeyMap[Qt::Key_F20 ] = osgGA::GUIEventAdapter::KEY_F20;
72 mKeyMap[Qt::Key_hyphen ] =
'-';
73 mKeyMap[Qt::Key_Equal ] =
'=';
75 mKeyMap[Qt::Key_division ] = osgGA::GUIEventAdapter::KEY_KP_Divide;
76 mKeyMap[Qt::Key_multiply ] = osgGA::GUIEventAdapter::KEY_KP_Multiply;
77 mKeyMap[Qt::Key_Minus ] =
'-';
78 mKeyMap[Qt::Key_Plus ] =
'+';
88 mKeyMap[Qt::Key_Insert ] = osgGA::GUIEventAdapter::KEY_KP_Insert;
91 modKeyMap[osgGA::GUIEventAdapter::MODKEY_CTRL ] = Qt::ControlModifier;
100 KeyMap::iterator itr = mKeyMap.find((Qt::Key)event->key());
101 if (itr == mKeyMap.end())
103 return int(*(event->text().toLatin1().data()));
113 for (KeyMap::iterator itr = mKeyMap.begin(); itr != mKeyMap.end(); ++itr) {
114 if (itr->second == key)
115 return new QKeyEvent(QEvent::KeyPress, itr->first, 0);
124 ModKeyMap::const_iterator it = modKeyMap.find(modMask);
125 if (it != modKeyMap.end())
126 return new QKeyEvent(QEvent::KeyPress, it->second, 0);
132 ModKeyMap::const_iterator it = modKeyMap.find(modMask);
133 if (it != modKeyMap.end())
135 return Qt::NoModifier;
139 typedef std::map<Qt::Key, int> KeyMap;
142 typedef std::map<int, Qt::KeyboardModifiers> ModKeyMap;
~QtOsgKeyboard()
Definition: qt-osg-keyboard.hh:94
Definition: action-search-bar.hh:27
QKeyEvent * remapKey(int key)
Definition: qt-osg-keyboard.hh:109
QtOsgKeyboard()
Definition: qt-osg-keyboard.hh:28
Qt::KeyboardModifiers getQtModKey(int modMask)
Definition: qt-osg-keyboard.hh:130
QKeyEvent * remapModKey(int modMask)
Definition: qt-osg-keyboard.hh:120
int remapKey(QKeyEvent *event)
Definition: qt-osg-keyboard.hh:98
Definition: qt-osg-keyboard.hh:26