Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Arrows keys don’t catch in keyPressEvent()
QtWS25 Last Chance

Arrows keys don’t catch in keyPressEvent()

Scheduled Pinned Locked Moved Unsolved General and Desktop
keyskeypresseventevent
6 Posts 2 Posters 12.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    IL
    wrote on 14 Jan 2016, 07:16 last edited by
    #1

    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

    R 1 Reply Last reply 14 Jan 2016, 07:25
    0
    • I IL
      14 Jan 2016, 07:16

      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

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 14 Jan 2016, 07:25 last edited by
      #2

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

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      I 1 Reply Last reply 14 Jan 2016, 07:47
      0
      • R raven-worx
        14 Jan 2016, 07:25

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

        I Offline
        I Offline
        IL
        wrote on 14 Jan 2016, 07:47 last edited by
        #3

        @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

        R 1 Reply Last reply 14 Jan 2016, 07:56
        0
        • I IL
          14 Jan 2016, 07:47

          @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

          R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 14 Jan 2016, 07:56 last edited by
          #4

          @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.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          I 1 Reply Last reply 14 Jan 2016, 10:52
          0
          • R raven-worx
            14 Jan 2016, 07:56

            @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.

            I Offline
            I Offline
            IL
            wrote on 14 Jan 2016, 10:52 last edited by
            #5

            @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!

            R 1 Reply Last reply 14 Jan 2016, 11:58
            0
            • I IL
              14 Jan 2016, 10:52

              @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!

              R Offline
              R Offline
              raven-worx
              Moderators
              wrote on 14 Jan 2016, 11:58 last edited by
              #6

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

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              0

              6/6

              14 Jan 2016, 11:58

              • Login

              • Login or register to search.
              6 out of 6
              • First post
                6/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved