Hi Legeo
I had a similar problem - using osg, qt4 and the AdapterWidget example.
In AdapterWidget::keypressEvent (...)
osgGA::GUIEventAdapter::KeySymbol) * (event->text().toAscii().data() returns
0 in the call
_gw->getEventQueue()->keyPress( (... ) ) for keys like:
Qt::Key_up ... Have a look at the Qt documentation Qt::Key.
I have managed it with:
int c = *event->text().toAscii().data();
if ( c == 0)
{
switch (event->key())
{
case Qt::Key_PageDown:
_gw->getEventQueue()->keyPress(
osgGA::GUIEventAdapter::KeySymbol::KEY_Page_Down );
break;
case Qt::Key_PageUp:
_gw->getEventQueue()->keyPress(
osgGA::GUIEventAdapter::KeySymbol::KEY_Page_Up );
break;
case Qt::Key_Up:
_gw->getEventQueue()->keyPress( osgGA::GUIEventAdapter::KEY_Up);
break;
}
}
else
_gw->getEventQueue()->keyPress( (osgGA::GUIEventAdapter::KeySymbol) *
(event->text().toAscii().data() ) );
There might be a better solution but it works.
Dieter
Unclassified Mail
-----Original Message-----
From: [email protected]
[mailto:[email protected]]on Behalf Of legeochen
Sent: Saturday, 07 March, 2009 09:14
To: OpenSceneGraph Users
Subject: [osg-users] osg+QT MODKEY How to
Hi all,
I'm trying to add a Modkey event handler to my application with osg and
qt4. But it seems that the getModKeyMask() fuction fails to work. Return
value of getModKeyMask() always is 0, even if I have a MODKEY pressed. And,
this is my code:
if ( ea.getEventType() == osgGA::GUIEventAdapter::PUSH &&
ea.getButtonMask() ==
osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON &&
ea.getModKeyMask() == osgGA::GUIEventAdapter::MODKEY_SHIFT )
{
/*---------------------------------------------
do something here
-------------------------------------------------*/
}
How can I handle it? Thanks in advance!
cheers
legeo
------------------------------------------------------------------------------------------------------------
Disclaimer:
If you are not the intended recipient of this email, please notify the sender
and delete it.
Any unauthorized copying, disclosure or distribution of this email or its
attachment(s) is forbidden.
Thales Nederland BV will not accept liability for any damage caused by this
email or its attachment(s).
Thales Nederland BV is seated in Hengelo and is registered at the Chamber of
Commerce under number 06061578.
------------------------------------------------------------------------------------------------------------
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org