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. Keyboard Arrow Navigation For Media Player
Forum Updated to NodeBB v4.3 + New Features

Keyboard Arrow Navigation For Media Player

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 4 Posters 780 Views 1 Watching
  • 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.
  • D Offline
    D Offline
    DzCode
    wrote on last edited by
    #1

    Hi all,

    I have 3 mediaplayer and 3 videowidgets in 3 different frames.

    They are split with QSplitter in a main frame, and all 3 are controlled with the same time slider.

    I have buttons for moving forwards/backwards. Now, I want to put a QAction for moving forwards/backwards. However, I coulnot catch any action. Also, I cannot catch key press event inside qwidgets.

    How can I put keyboard navigation for my videos?

    jsulmJ 1 Reply Last reply
    0
    • D DzCode

      Hi all,

      I have 3 mediaplayer and 3 videowidgets in 3 different frames.

      They are split with QSplitter in a main frame, and all 3 are controlled with the same time slider.

      I have buttons for moving forwards/backwards. Now, I want to put a QAction for moving forwards/backwards. However, I coulnot catch any action. Also, I cannot catch key press event inside qwidgets.

      How can I put keyboard navigation for my videos?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @DzCode said in Keyboard Arrow Navigation For Media Player:

      I coulnot catch any action

      And I (and most probably others) cannot know why. You will need to show what you are doing.

      "Also, I cannot catch key press event inside qwidgets" - same here and also make sure the widgets have focus.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply
      0
      • jsulmJ jsulm

        @DzCode said in Keyboard Arrow Navigation For Media Player:

        I coulnot catch any action

        And I (and most probably others) cannot know why. You will need to show what you are doing.

        "Also, I cannot catch key press event inside qwidgets" - same here and also make sure the widgets have focus.

        D Offline
        D Offline
        DzCode
        wrote on last edited by
        #3

        @jsulm can I do it without giving them a focus?

        Because, there are so much different widgets in the application.

        jsulmJ 1 Reply Last reply
        0
        • D DzCode

          @jsulm can I do it without giving them a focus?

          Because, there are so much different widgets in the application.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @DzCode said in Keyboard Arrow Navigation For Media Player:

          can I do it without giving them a focus?

          Do it in the container widget then

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          D 1 Reply Last reply
          0
          • jsulmJ jsulm

            @DzCode said in Keyboard Arrow Navigation For Media Player:

            can I do it without giving them a focus?

            Do it in the container widget then

            D Offline
            D Offline
            DzCode
            wrote on last edited by DzCode
            #5

            @jsulm Actually I tried to add the qactions into mainwindow too to test but they are not trigger. I will try the keypressevent of it.

            Edit: I tried but nothing works,

            Child widgets negates it

            D 1 Reply Last reply
            0
            • D DzCode

              @jsulm Actually I tried to add the qactions into mainwindow too to test but they are not trigger. I will try the keypressevent of it.

              Edit: I tried but nothing works,

              Child widgets negates it

              D Offline
              D Offline
              DzCode
              wrote on last edited by
              #6

              @DzCode I think only eventfilter gives a response for that. I need to catch the watched object

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Hi,

                As @jsulm wrote, without any code we can't even guess what might be going wrong.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • JoeCFDJ Offline
                  JoeCFDJ Offline
                  JoeCFD
                  wrote on last edited by JoeCFD
                  #8
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • JoeCFDJ Offline
                    JoeCFDJ Offline
                    JoeCFD
                    wrote on last edited by
                    #9

                    Your problem can be confirmed. Only these arrow keys do not triggger key event to
                    protected:
                    void keyPressEvent(QKeyEvent *e) override;

                    But check this out.
                    https://stackoverflow.com/questions/10942384/handling-left-and-right-key-events-in-qt

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      DzCode
                      wrote on last edited by DzCode
                      #10

                      At first, thank you all.

                      I solved my problem.

                      Since I cannot share the code, I will explain what I did.

                      I gave object names to my videowidget and any related widget related with videos (buttons, slider, etc.)

                      In the eventfilter, I am filtering KeyPress and object name of the watched objects. If it suits my criteria, it will handles the arrow key navigation, otherwise upper class'es eventfilter is called.

                      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