Uint glwidget: convertqttoceguikey (INT key, QT: keyboardmodifiers modifiers)
{
If (modifiers & QT: keypadmodifier)
{
Switch (key)
{
Case QT: key_minus: Return cegui: Key: Subtract;
Case QT: key_period: Return cegui: Key: decimal;
Case QT: key_slash: Return cegui: Key: divide;
Case QT: key_enter: Return cegui: Key: numpadenter;
Case QT: key_0: Return cegui: Key: numpad0;
Case QT: key_1: Return cegui: Key: numpad1;
Case QT: key_2: Return cegui: Key: numpad2;
Case QT: key_3: Return cegui: Key: numpad3;
Case QT: key_4: Return cegui: Key: numpad4;
Case QT: key_5: Return cegui: Key: numpad5;
Case QT: key_6: Return cegui: Key: numpad6;
Case QT: key_7: Return cegui: Key: numpad7;
Case QT: key_8: Return cegui: Key: numpad8;
Case QT: key_9: Return cegui: Key: numpad9;
Case QT: key_asterisk: Return cegui: Key: multiply;
Case QT: key_plus: Return cegui: Key: Add;
Case QT: key_equal: Return cegui: Key: numpadequals;
}
}
Else
{
Switch (key)
{
Case QT: key_at: Return cegui: Key:;
Case QT: key_backspace: Return cegui: Key: backspace;
Case QT: key_tab: Return cegui: Key: tab;
Case QT: key_pause: Return cegui: Key: Pause;
Case QT: key_escape: Return cegui: Key: escape;
Case QT: key_space: Return cegui: Key: space;
Case QT: key_comma: Return cegui: Key: comma;
Case QT: key_quoteleft: Return cegui: Key: apostrophe;
Case QT: key_minus: Return cegui: Key: minus;
Case QT: key_period: Return cegui: Key: period;
Case QT: key_slash: Return cegui: Key: Slash;
Case QT: key_return: Return cegui: Key: return;
Case QT: key_0: Return cegui: Key: zero;
Case QT: key_1: Return cegui: Key: one;
Case QT: key_2: Return cegui: Key: Two;
Case QT: key_3: Return cegui: Key: three;
Case QT: key_4: Return cegui: Key: four;
Case QT: key_5: Return cegui: Key: five;
Case QT: key_6: Return cegui: Key: six;
Case QT: key_7: Return cegui: Key: seven;
Case QT: key_8: Return cegui: Key: eight;
Case QT: key_9: Return cegui: Key: nine;
Case QT: key_colon: Return cegui: Key: Colon;
Case QT: key_semicolon: Return cegui: Key: semicolon;
Case QT: key_equal: Return cegui: Key: equals;
Case QT: key_bracketleft: Return cegui: Key: leftbracket;
Case QT: key_backslash: Return cegui: Key: backslash;
Case QT: key_bracketright: Return cegui: Key: rightbracket;
Case QT: key_a: Return cegui: Key:;
Case QT: key_ B: Return cegui: Key: B;
Case QT: key_c: Return cegui: Key: C;
Case QT: key_d: Return cegui: Key: D;
Case QT: key_e: Return cegui: Key: E;
Case QT: key_f: Return cegui: Key: F;
Case QT: key_g: Return cegui: Key: G;
Case QT: key_h: Return cegui: Key: h;
Case QT: key_ I: Return cegui: Key: I;
Case QT: key_j: Return cegui: Key: J;
Case QT: key_k: Return cegui: Key: K;
Case QT: key_l: Return cegui: Key: L;
Case QT: key_m: Return cegui: Key: m;
Case QT: key_n: Return cegui: Key: N;
Case QT: key_o: Return cegui: Key: O;
Case QT: key_p: Return cegui: Key: P;
Case QT: key_q: Return cegui: Key: Q;
Case QT: key_r: Return cegui: Key: R;
Case QT: key_s: Return cegui: Key: S;
Case QT: key_t: Return cegui: Key: T;
Case QT: key_u: Return cegui: Key: U;
Case QT: key_v: Return cegui: Key: V;
Case QT: key_w: Return cegui: Key: W;
Case QT: key_x: Return cegui: Key: X;
Case QT: key_y: Return cegui: Key: Y;
Case QT: key_z: Return cegui: Key: Z;
Case QT: key_delete: Return cegui: Key: Delete;
Case QT: key_up: Return cegui: Key: arrowup;
Case QT: key_down: Return cegui: Key: arrowdown;
Case QT: key_right: Return cegui: Key: arrowright;
Case QT: key_left: Return cegui: Key: arrowleft;
Case QT: key_insert: Return cegui: Key: insert;
Case QT: key_home: Return cegui: Key: home;
Case QT: key_end: Return cegui: Key: end;
Case QT: key_pageup: Return cegui: Key: Pageup;
Case QT: key_pagedown: Return cegui: Key: Pagedown;
Case QT: key_f1: Return cegui: Key: F1;
Case QT: key_f2: Return cegui: Key: F2;
Case QT: key_f3: Return cegui: Key: F3;
Case QT: key_f4: Return cegui: Key: F4;
Case QT: key_f5: Return cegui: Key: F5;
Case QT: key_f6: Return cegui: Key: F6;
Case QT: key_f7: Return cegui: Key: F7;
Case QT: key_f8: Return cegui: Key: F8;
Case QT: key_f9: Return cegui: Key: F9;
Case QT: key_f10: Return cegui: Key: F10;
Case QT: key_f11: Return cegui: Key: F11;
Case QT: key_f12: Return cegui: Key: F12;
Case QT: key_f13: Return cegui: Key: f13;
Case QT: key_f14: Return cegui: Key: F14;
Case QT: key_f15: Return cegui: Key: F15;
Case QT: key_numlock: Return cegui: Key: numlock;
Case QT: key_scrolllock: Return cegui: Key: scrolllock;
Case QT: key_shift: Return cegui: Key: rightshift;
Case QT: key_control: Return cegui: Key: rightcontrol;
Case QT: key_alt: Return cegui: Key: rightalt;
Case QT: key_meta: Return cegui: Key: leftwindows;
Case QT: key_sysreq: Return cegui: Key: sysrq;
Case QT: key_menu: Return cegui: Key: appmenu;
}
}
Return 0;
}
Cegui: mousebutton glwidget: convertqttoceguimousebutton (QT: mousebutton)
{
Switch (button)
{
Case QT: leftbutton: Return cegui: leftbutton;
Case QT: rightbutton: Return cegui: rightbutton;
Case QT: midbutton: Return cegui: middlebutton;
Case QT: xbutton1: Return cegui: x1button;
Case QT: xbutton2: Return cegui: x2button;
Default: Return cegui: nobutton;
}
}
// These functions can be used in key and mouse event handlers to inject events to cegui: System
Void glwidget: keypressevent (qkeyevent * event)
{
Bool processed = (Event-> text (). size () = 1) & cegui: System: getsingleton (). injectchar (Event-> text (). at (0 ). unicode ());
If (! Processed)
Processed = processed | cegui: System: getsingleton (). injectkeydown (convertqttoceguikey (Event-> key (), event-> modifiers ()));
}
Void glwidget: mousepressevent (qmouseevent * event)
{
Cegui: System: getsingleton (). injectmousebuttondown (convertqttoceguimousebutton (Event-> button ()));
}