Results 1 to 6 of 6

Thread: Clearing keyboard event on focusChange

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2015
    Posts
    52
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Clearing keyboard event on focusChange

    I've set 'L' to switch the focus from a QGraphicsView to a QListView. The problem is that as the documentation states, the Keyboard events are not cleared and therefore the list processes the keypress and jumps to the element starting with the letter L.

    How can I clear/ignore that one keypress?

    Cheers!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Clearing keyboard event on focusChange

    How do you handle the 'L' key right now?
    Some custom key event handler?

    Cheers,
    _

  3. #3
    Join Date
    Jul 2015
    Posts
    52
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Clearing keyboard event on focusChange

    I'm using the main widget's virtual void keyReleaseEvent(QKeyEvent *e);

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Clearing keyboard event on focusChange

    Ok, I had hoped for some actual code, but providing actually useful information should not be hoped for in this time and age.
    But then again it means any suggestion can be vague as well

    Try delaying the focus change.
    Ah, heck, try calling setFocus() delayed.

    Cheers,
    _

Similar Threads

  1. Keyboard event and QTextEdit
    By kaszewczyk in forum Newbie
    Replies: 2
    Last Post: 2nd November 2009, 19:30
  2. Mouse & KeyBoard Event
    By anafor2004 in forum Newbie
    Replies: 2
    Last Post: 26th October 2009, 11:39
  3. How to grad keyboard event
    By lengshuang in forum Qt Programming
    Replies: 1
    Last Post: 8th April 2009, 13:03
  4. how to manipulate the keyboard event?
    By Ricardo_arg in forum Qt Programming
    Replies: 2
    Last Post: 4th August 2008, 07:49
  5. Capture a keyboard event
    By mahe2310 in forum Qt Programming
    Replies: 8
    Last Post: 16th February 2006, 11:19

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
  •  
Qt is a trademark of The Qt Company.