Results 1 to 2 of 2

Thread: autorepeat and the alt key

  1. #1
    Join Date
    Aug 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default autorepeat and the alt key

    Hello,
    I've installed an event filter in my app, and I'm trying to catch key events.

    my code looks like this:

    Qt Code:
    1. bool MyClass::eventFilter( QObject* pWindow, QEvent* pEvent )
    2. {
    3. if( dynamic_cast<QKeyEvent*>(pEvent) )
    4. {
    5. OutputDebugString( L"key\n" );
    6. }
    7. }
    To copy to clipboard, switch view to plain text mode 

    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?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: autorepeat and the alt key

    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 () ;

Similar Threads

  1. Autorepeat within eventfilter
    By Patrick_Bao in forum Qt Programming
    Replies: 0
    Last Post: 1st December 2010, 07:37
  2. Howto handle key-release with autorepeat key
    By gould75 in forum Qt Programming
    Replies: 2
    Last Post: 20th August 2006, 07:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.