PDA

View Full Version : autorepeat and the alt key



indigox3
12th August 2011, 22:17
Hello,
I've installed an event filter in my app, and I'm trying to catch key events.

my code looks like this:



bool MyClass::eventFilter( QObject* pWindow, QEvent* pEvent )
{
if( dynamic_cast<QKeyEvent*>(pEvent) )
{
OutputDebugString( L"key\n" );
}
}


When I hold down a key, I get several events. They stop when I release the key. That is what I want, so that's good.

However when I hold down the alt key, I don't get multiple events when holding down the key. I only get one or two QKeyEvents.

Does anyone know why?

Santosh Reddy
13th August 2011, 03:36
alt key is considered as key modifier in Qt, so I guess this is reason for only two events, you can check for alt key down(Qt::AltModifier) flag in QKeyEvent::modifiers () ;