<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://cegui.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Eldarin</id>
		<title>CEGUI Wiki - Crazy Eddie's GUI System (Open Source) - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://cegui.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Eldarin"/>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/Special:Contributions/Eldarin"/>
		<updated>2026-04-08T04:13:39Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=Qt_to_CEGUI_Key_and_Mouse_Mapping&amp;diff=2720</id>
		<title>Qt to CEGUI Key and Mouse Mapping</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=Qt_to_CEGUI_Key_and_Mouse_Mapping&amp;diff=2720"/>
				<updated>2007-10-03T09:49:56Z</updated>
		
		<summary type="html">&lt;p&gt;Eldarin: Qt to CEGUI mapping described.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
uint GLWidget::convertQtToCEGUIKey (int key, Qt::KeyboardModifiers modifiers)&lt;br /&gt;
{&lt;br /&gt;
	if (modifiers &amp;amp; Qt::KeypadModifier)&lt;br /&gt;
	{&lt;br /&gt;
		switch (key)&lt;br /&gt;
		{&lt;br /&gt;
			case Qt::Key_Minus:	return CEGUI::Key::Subtract;&lt;br /&gt;
			case Qt::Key_Period:	return CEGUI::Key::Decimal;&lt;br /&gt;
			case Qt::Key_Slash:	return CEGUI::Key::Divide;&lt;br /&gt;
			case Qt::Key_Enter:	return CEGUI::Key::NumpadEnter;		&lt;br /&gt;
			case Qt::Key_0:		return CEGUI::Key::Numpad0;&lt;br /&gt;
			case Qt::Key_1:		return CEGUI::Key::Numpad1;&lt;br /&gt;
			case Qt::Key_2:		return CEGUI::Key::Numpad2;&lt;br /&gt;
			case Qt::Key_3:		return CEGUI::Key::Numpad3;&lt;br /&gt;
			case Qt::Key_4:		return CEGUI::Key::Numpad4;&lt;br /&gt;
			case Qt::Key_5:		return CEGUI::Key::Numpad5;&lt;br /&gt;
			case Qt::Key_6:		return CEGUI::Key::Numpad6;&lt;br /&gt;
			case Qt::Key_7:		return CEGUI::Key::Numpad7;&lt;br /&gt;
			case Qt::Key_8:		return CEGUI::Key::Numpad8;&lt;br /&gt;
			case Qt::Key_9:		return CEGUI::Key::Numpad9;&lt;br /&gt;
			case Qt::Key_Asterisk:	return CEGUI::Key::Multiply;&lt;br /&gt;
			case Qt::Key_Plus:	return CEGUI::Key::Add;&lt;br /&gt;
			case Qt::Key_Equal:	return CEGUI::Key::NumpadEquals;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else&lt;br /&gt;
	{&lt;br /&gt;
		switch (key)&lt;br /&gt;
		{&lt;br /&gt;
			case Qt::Key_At:		return CEGUI::Key::At;&lt;br /&gt;
			case Qt::Key_Backspace: 	return CEGUI::Key::Backspace;&lt;br /&gt;
			case Qt::Key_Tab:		return CEGUI::Key::Tab;&lt;br /&gt;
			case Qt::Key_Pause:		return CEGUI::Key::Pause;&lt;br /&gt;
			case Qt::Key_Escape:		return CEGUI::Key::Escape;&lt;br /&gt;
			case Qt::Key_Space:		return CEGUI::Key::Space;&lt;br /&gt;
			case Qt::Key_Comma:		return CEGUI::Key::Comma;&lt;br /&gt;
			case Qt::Key_QuoteLeft:		return CEGUI::Key::Apostrophe;&lt;br /&gt;
			case Qt::Key_Minus:		return CEGUI::Key::Minus;&lt;br /&gt;
			case Qt::Key_Period:		return CEGUI::Key::Period;&lt;br /&gt;
			case Qt::Key_Slash:		return CEGUI::Key::Slash;&lt;br /&gt;
			case Qt::Key_Return:		return CEGUI::Key::Return;&lt;br /&gt;
			case Qt::Key_0:			return CEGUI::Key::Zero;&lt;br /&gt;
			case Qt::Key_1:			return CEGUI::Key::One;&lt;br /&gt;
			case Qt::Key_2:			return CEGUI::Key::Two;&lt;br /&gt;
			case Qt::Key_3:			return CEGUI::Key::Three;&lt;br /&gt;
			case Qt::Key_4:			return CEGUI::Key::Four;&lt;br /&gt;
			case Qt::Key_5:			return CEGUI::Key::Five;&lt;br /&gt;
			case Qt::Key_6:			return CEGUI::Key::Six;&lt;br /&gt;
			case Qt::Key_7:			return CEGUI::Key::Seven;&lt;br /&gt;
			case Qt::Key_8:			return CEGUI::Key::Eight;&lt;br /&gt;
			case Qt::Key_9:			return CEGUI::Key::Nine;&lt;br /&gt;
			case Qt::Key_Colon:		return CEGUI::Key::Colon;&lt;br /&gt;
			case Qt::Key_Semicolon:		return CEGUI::Key::Semicolon;&lt;br /&gt;
			case Qt::Key_Equal:		return CEGUI::Key::Equals;&lt;br /&gt;
			case Qt::Key_BracketLeft:	return CEGUI::Key::LeftBracket;&lt;br /&gt;
			case Qt::Key_Backslash:		return CEGUI::Key::Backslash;&lt;br /&gt;
			case Qt::Key_BracketRight:	return CEGUI::Key::RightBracket;&lt;br /&gt;
			case Qt::Key_A:			return CEGUI::Key::A;&lt;br /&gt;
			case Qt::Key_B:			return CEGUI::Key::B;&lt;br /&gt;
			case Qt::Key_C:			return CEGUI::Key::C;&lt;br /&gt;
			case Qt::Key_D:			return CEGUI::Key::D;&lt;br /&gt;
			case Qt::Key_E:			return CEGUI::Key::E;&lt;br /&gt;
			case Qt::Key_F:			return CEGUI::Key::F;&lt;br /&gt;
			case Qt::Key_G:			return CEGUI::Key::G;&lt;br /&gt;
			case Qt::Key_H:			return CEGUI::Key::H;&lt;br /&gt;
			case Qt::Key_I:			return CEGUI::Key::I;&lt;br /&gt;
			case Qt::Key_J:			return CEGUI::Key::J;&lt;br /&gt;
			case Qt::Key_K:			return CEGUI::Key::K;&lt;br /&gt;
			case Qt::Key_L:			return CEGUI::Key::L;&lt;br /&gt;
			case Qt::Key_M:			return CEGUI::Key::M;&lt;br /&gt;
			case Qt::Key_N:			return CEGUI::Key::N;&lt;br /&gt;
			case Qt::Key_O:			return CEGUI::Key::O;&lt;br /&gt;
			case Qt::Key_P:			return CEGUI::Key::P;&lt;br /&gt;
			case Qt::Key_Q:			return CEGUI::Key::Q;&lt;br /&gt;
			case Qt::Key_R:			return CEGUI::Key::R;&lt;br /&gt;
			case Qt::Key_S:			return CEGUI::Key::S;&lt;br /&gt;
			case Qt::Key_T:			return CEGUI::Key::T;&lt;br /&gt;
			case Qt::Key_U:			return CEGUI::Key::U;&lt;br /&gt;
			case Qt::Key_V:			return CEGUI::Key::V;&lt;br /&gt;
			case Qt::Key_W:			return CEGUI::Key::W;&lt;br /&gt;
			case Qt::Key_X:			return CEGUI::Key::X;&lt;br /&gt;
			case Qt::Key_Y:			return CEGUI::Key::Y;&lt;br /&gt;
			case Qt::Key_Z:			return CEGUI::Key::Z;&lt;br /&gt;
			case Qt::Key_Delete:		return CEGUI::Key::Delete;&lt;br /&gt;
			case Qt::Key_Up:		return CEGUI::Key::ArrowUp;&lt;br /&gt;
			case Qt::Key_Down:		return CEGUI::Key::ArrowDown;&lt;br /&gt;
			case Qt::Key_Right:		return CEGUI::Key::ArrowRight;&lt;br /&gt;
			case Qt::Key_Left:		return CEGUI::Key::ArrowLeft;&lt;br /&gt;
			case Qt::Key_Insert:		return CEGUI::Key::Insert;&lt;br /&gt;
			case Qt::Key_Home:		return CEGUI::Key::Home;&lt;br /&gt;
			case Qt::Key_End:		return CEGUI::Key::End;&lt;br /&gt;
			case Qt::Key_PageUp:		return CEGUI::Key::PageUp;&lt;br /&gt;
			case Qt::Key_PageDown:		return CEGUI::Key::PageDown;&lt;br /&gt;
			case Qt::Key_F1:		return CEGUI::Key::F1;&lt;br /&gt;
			case Qt::Key_F2:		return CEGUI::Key::F2;&lt;br /&gt;
			case Qt::Key_F3:		return CEGUI::Key::F3;&lt;br /&gt;
			case Qt::Key_F4:		return CEGUI::Key::F4;&lt;br /&gt;
			case Qt::Key_F5:		return CEGUI::Key::F5;&lt;br /&gt;
			case Qt::Key_F6:		return CEGUI::Key::F6;&lt;br /&gt;
			case Qt::Key_F7:		return CEGUI::Key::F7;&lt;br /&gt;
			case Qt::Key_F8:		return CEGUI::Key::F8;&lt;br /&gt;
			case Qt::Key_F9:		return CEGUI::Key::F9;&lt;br /&gt;
			case Qt::Key_F10:		return CEGUI::Key::F10;&lt;br /&gt;
			case Qt::Key_F11:		return CEGUI::Key::F11;&lt;br /&gt;
			case Qt::Key_F12:		return CEGUI::Key::F12;&lt;br /&gt;
			case Qt::Key_F13:		return CEGUI::Key::F13;&lt;br /&gt;
			case Qt::Key_F14:		return CEGUI::Key::F14;&lt;br /&gt;
			case Qt::Key_F15:		return CEGUI::Key::F15;&lt;br /&gt;
			case Qt::Key_NumLock:		return CEGUI::Key::NumLock;&lt;br /&gt;
			case Qt::Key_ScrollLock:	return CEGUI::Key::ScrollLock;&lt;br /&gt;
			case Qt::Key_Shift:		return CEGUI::Key::RightShift;&lt;br /&gt;
			case Qt::Key_Control:		return CEGUI::Key::RightControl;&lt;br /&gt;
			case Qt::Key_Alt:		return CEGUI::Key::RightAlt;&lt;br /&gt;
			case Qt::Key_Meta:		return CEGUI::Key::LeftWindows;&lt;br /&gt;
			case Qt::Key_SysReq:		return CEGUI::Key::SysRq;&lt;br /&gt;
			case Qt::Key_Menu:		return CEGUI::Key::AppMenu;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
CEGUI::MouseButton GLWidget::convertQtToCEGUIMouseButton (Qt::MouseButton button)&lt;br /&gt;
{&lt;br /&gt;
	switch (button)&lt;br /&gt;
	{&lt;br /&gt;
		case Qt::LeftButton:	return CEGUI::LeftButton;&lt;br /&gt;
		case Qt::RightButton:	return CEGUI::RightButton;&lt;br /&gt;
		case Qt::MidButton:	return CEGUI::MiddleButton;&lt;br /&gt;
		case Qt::XButton1:	return CEGUI::X1Button;&lt;br /&gt;
		case Qt::XButton2:	return CEGUI::X2Button;&lt;br /&gt;
		default:		return CEGUI::NoButton;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These functions can be used in key and mouse event handlers to inject events to CEGUI::System:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
void GLWidget::keyPressEvent (QKeyEvent* event)&lt;br /&gt;
{&lt;br /&gt;
	bool processed = (event-&amp;gt;text ().size () == 1) &amp;amp;&amp;amp; CEGUI::System::getSingleton ().injectChar (event-&amp;gt;text ().at (0).unicode ());&lt;br /&gt;
	if (!processed)&lt;br /&gt;
		processed = processed || CEGUI::System::getSingleton ().injectKeyDown (convertQtToCEGUIKey (event-&amp;gt;key (), event-&amp;gt;modifiers ()));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void GLWidget::mousePressEvent (QMouseEvent* event)&lt;br /&gt;
{&lt;br /&gt;
	CEGUI::System::getSingleton ().injectMouseButtonDown (convertQtToCEGUIMouseButton (event-&amp;gt;button ()));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Eldarin</name></author>	</entry>

	</feed>