First time, button need double click to trigger. Next time, just one click.
-
@ambershark Thank for your support. I think my code is root cause issue happen. I will debug and show result late.
Thank so much
-
@Hung-Tran You're welcome :) Let us know what you find out.
-
Wow, It's difficult to explain to you. But I have short information to you:
- I use Qt for GUI that control action of player. And use GStreamer for playback. Don't playback by qt because qt can't control hardward as my expected.
- GUI action will call API of GStreamer.
- Before playback by Gstreamer, GUI action as expected. But When playback by GStreamer, I control media output by Qt. Output will scale full screen after that I call GUI control play,stop, trick play...So when this GUI appear, I think it is in behind of media output so I need click first time to make focus on GUI and one more to trigger action.
=> Do you understand what I say and do you have any solution for this case ?
Or may be it is bug of Wayland because output is shown on wayland Platform.
Thank you
-
@Hung-Tran Ok yea I get it now. You explained it very well.
My guess based on what you said is that it is a problem with how you get focus to a window in your window manager.
Which window manager are you using? Most can be set to activate and pass mouse click, or just activate window on click, etc.
So with that in mind a quick test to see if you are having a "focus click" then "activate" click is to click somewhere else in that GUI window that pops up. This will focus it. Then click your button to activate. If it works with 1 click then focus is your issue. If not there may be something deeper going on.
Either way with a bit more info I might be able to suggest some possible fixes.
Also, quick note on wayland.. In my opinion there are still a lot of problems with wayland. I just don't feel it's ready for prime time yet. This could definitely be a problem related to wayland, but you can always test on xorg or something to see if the problem goes away. That would let you know if it's a wayland issue or not.
-
This is my process:
- App run, QMainWindow show QWidget myMainUi
- on myUi have Open button, when click Open button then QFileDialog appear ( I want QDialog appear on middle screen so I create new QWidget *openfileContainerwith full screen that contain QFileDialog).
- After i select video file (QFileDialog close native) and I hide openfileContainer:
myMainUi->hide(); if (!openfileContainer) { openfileContainer = new QWidget(); } openfileContainer->setStyleSheet("background: black;"); openfileContainer->move(0, 0); openfileContainer->resize(1920, 1080); openfileContainer->show(); QFileDialog* dialog = new QFileDialog(openfileContainer); dialog->setStyleSheet("background: #eee;"); dialog->setFileMode(QFileDialog::ExistingFile); dialog->setNameFilter(QObject::tr("Clip (*.mkv *.avi *.mp4 *.divx)")); dialog->setViewMode(QFileDialog::Detail); dialog->setOption(QFileDialog::DontUseNativeDialog); dialog->setDirectory(QObject::tr("/home/root/video")); res = dialog->exec(); openfileContainer->resize(0, 0); openfileContainer->hide(); myMainUi->show();
after that I show myMainUi;
myMainUi->show();
- Play video
this->myState.setState(DivXPlayerState::APP_STATE_PLAY); sleep(2); myMainUi->hide(); myMainUi->show();
From now, I don't know why APP can not focus to myMainUi after I show it. I tried to set APP focus on myMainUi but it does not work.
this->myState.setState(DivXPlayerState::APP_STATE_PLAY); sleep(2); myMainUi->hide(); myMainUi->show(); //new code myMainUi->setFocusPolicy(Qt::StrongFocus); myMainUi->setFocus();
Do you have any solution for this case?
-
@ambershark I also have concern about:
When I call:
gst_element_set_state(myPipeLine, GST_STATE_PLAYING);
It means APP playback by GStreamer and media output set full screen.
After that, I show myMainUi so I think media output overlay UI of APP because Media Output is independent with UI of app. If it is reason, how I can fix it ? -
Hi,
Since you seem to be using low-level GStreamer code then you should consider the QtGStreamer module.
-
@Hung-Tran Well the problem here is getting focus to your window. When gstreamer takes over you lose focus.
I don't think you can get focus back in linux without user intervention. It's been a while since I tested this so you can try and find out.
The calls you need to attempt to gain focus are
activateWindow()
andraise()
both are part of QWidget.Like I said though, no guarantee that you will get focus. That is up to the window manager and most these days prevent applications from "stealing" focus without user interaction. This is true in Windows and OSX as well.
-
@ambershark I have a question:
How to know where mouse focus on when app running ?
I'm trying get focus to control UI but I have no luck. So I want to check when app change state, where mouse focus on. -
@Hung-Tran That is something you will need to do specific to each OS. There is no way to do it with Qt (that I'm aware of).
For instance, here is how you would do it with X11 http://stackoverflow.com/questions/1014822/how-to-know-which-window-has-focus-and-how-to-change-it.
-
@ambershark Sry for late reply.
In my case, I finally uses code C to create fake clicking on UI to active UI. I can't solve this issue by Qt5 so I have no choose for this issues. It's not my expected but It can make my APP better than.