Results 1 to 8 of 8

Thread: Cannot capture Key_Up

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cannot capture Key_Up

    What's the focus policy of the widget you want to capture the key in?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Aug 2009
    Posts
    32
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot capture Key_Up

    Everything is set to default.

    I'm assuming the MainWindow and centralwidget() configuration do something to intercept the Up/Down Keys.

    I figured that's why I get the QEvent::ShortcutOverride event when I press the Up/Down key while sniffing the Foo widget's events.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cannot capture Key_Up

    Quote Originally Posted by xenome View Post
    Everything is set to default.

    I'm assuming the MainWindow and centralwidget() configuration do something to intercept the Up/Down Keys.
    Default focus policy of QWidget (and QMainWindow as well) is NoFocus.

    Your widget simply doesn't have focus so it won't receive key events. If you want something to happen on a specific key combination you can register a shortcut for that combination - this is done via QShortcut (of course you still won't receive a keyPressEvent in your widget).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Aug 2009
    Posts
    32
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot capture Key_Up

    Well I would think it has some focus as I receive all key events except the arrows.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cannot capture Key_Up

    Please provide a minimal compilable example reproducing the problem.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 3
    Last Post: 5th July 2009, 17:22
  2. synchronise QLabel display and webcam capture
    By fbmfbm in forum Qt Programming
    Replies: 2
    Last Post: 24th February 2009, 11:10
  3. capture screen (with Mouse) ?
    By ascii in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2008, 12:16
  4. How to capture a window?
    By Misenko in forum Qt Programming
    Replies: 2
    Last Post: 12th September 2008, 15:36
  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.