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()
Forum Updated to NodeBB v4.3 + New Features

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.
  • ILI Offline
    ILI Offline
    IL
    wrote on 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

    raven-worxR 1 Reply Last reply
    0
    • ILI IL

      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

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on 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

      ILI 1 Reply Last reply
      0
      • raven-worxR raven-worx

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

        ILI Offline
        ILI Offline
        IL
        wrote on 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

        raven-worxR 1 Reply Last reply
        0
        • ILI IL

          @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

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on 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

          ILI 1 Reply Last reply
          0
          • raven-worxR raven-worx

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

            ILI Offline
            ILI Offline
            IL
            wrote on 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!

            raven-worxR 1 Reply Last reply
            0
            • ILI IL

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

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on 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

              • Login

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