Hi osg users,

I recently found something strange with osgQT, when a key release event is
added to the event queue the key value is always 0.

It seems to be related to the void GLWidget::keyReleaseEvent( QKeyEvent*
event ) function in the osgQT/GraphicsWindowQt.cpp file.

On key press the QKeyEvent is remaped to get the proper key value but not
in the key release event.

The code is :

void GLWidget::keyReleaseEvent( QKeyEvent* event )
{
    setKeyboardModifiers( event );
    _gw->getEventQueue()->keyRelease( (osgGA::GUIEventAdapter::KeySymbol)
*(event->text().toAscii().data()) );

    // this passes the event to the regular Qt key event processing,
    // among others, it closes popup windows on ESC and forwards the event
to the parent widgets
    if( _forwardKeyEvents )
        inherited::keyReleaseEvent( event );
}


But it should be :

void GLWidget::keyReleaseEvent( QKeyEvent* event )
{
    setKeyboardModifiers( event );
int value = s_QtKeyboardMap.remapKey( event );
_gw->getEventQueue()->keyRelease( value );

    // this passes the event to the regular Qt key event processing,
    // among others, it closes popup windows on ESC and forwards the event
to the parent widgets
    if( _forwardKeyEvents )
        inherited::keyReleaseEvent( event );
}


I made the fix on my version of the file and it works great.

I'm using OSG 3.0.1 and QT 4.8.0.

Kind regards,
-- 
Alexandre AMALRIC                   Ingénieur R&D
===================================
PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
http://www.pixxim.fr
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to