From Juan Manuel Alvarez, "When handling keyboard events on osgQt, if a key is kept pressed, multiple sequences of KEYDOWN -> KEYUP events are fired.
This is because Qt auto repeats keyboard events, so multiple calls are made to GLWidget::keyPressEvent and GLWidget::keyReleaseEvent by Qt, and subsequently translated to OSG events. The way to solve this is ignoring key released auto repeated events (see http://qt-project.org/doc/qt-4.8/qkeyevent.html#isAutoRepeat), so multiple KEYDOWN events are fired, but only one KEYUP. I attach a modified osgQt/GraphicsWindowQt.cpp with this change."
This commit is contained in:
parent
bab56f9854
commit
7d2f9f3a0d
@ -268,10 +268,17 @@ void GLWidget::keyPressEvent( QKeyEvent* event )
|
||||
}
|
||||
|
||||
void GLWidget::keyReleaseEvent( QKeyEvent* event )
|
||||
{
|
||||
if( event->isAutoRepeat() )
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user