Solved Keyboard Arrow Navigation For Media Player
-
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?
-
@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.
-
@jsulm can I do it without giving them a focus?
Because, there are so much different widgets in the application.
-
@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
-
@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
-
@DzCode I think only eventfilter gives a response for that. I need to catch the watched object
-
Hi,
As @jsulm wrote, without any code we can't even guess what might be going wrong.
-
This post is deleted! -
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 -
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.