Arrows keys don’t catch in keyPressEvent()



  • I have overridden the virtual protected keyPressEvent() function and able to catch most of the keys events except to Qt::key_Up/Down/Left/Right.
    Is there any other policy to grab those keys?

    Best regards,
    IL


  • Moderators

    @IL
    it depends where you've overwritten the keyPressEvent() handler in your widget hierarchy. For example maybe a child widget already consumed the event...



  • @raven-worx
    Currently I have only one UI (User Interface) so I have only one class that I am able to overwritten keypressevent function.
    What do you mean child widgets?
    Can it be that child widget like push button will grab my key press?

    Thanks


  • Moderators

    @IL said:

    Currently I have only one UI (User Interface) so I have only one class that I am able to overwritten keypressevent function.
    What do you mean child widgets?

    i am talking about event propagation to the parent widget. When the (focused) child widget already consumes (accepts) the event it will not get propagated to the parent widget.
    About what kind of widget are we talking here?
    Does the widget have input focus?

    Can it be that child widget like push button will grab my key press?

    yes, but it depends on the key. For example the SPACE key is consumed.



  • @raven-worx said:

    About what kind of widget are we talking here?

    Only push buttons.

    Does the widget have input focus?

    If I understand you correctly, each time I have focus on one of the widgets, push buttons
    What should I do in order to catch those key from the child widgets?

    Thank you!


  • Moderators

    i guess this issue will be solved along with your other issue.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.