PDA

View Full Version : What is the best practice for overlaying a Widget over Phonon::VideoWidget?



renevolution
2nd September 2015, 23:15
Dear fellow Qt-Devs,

the last couple of days i have tried to find a working solution to overlay a Phonon::VideoWidget with a simple QLabel.
Sadly i wasn't able to find a working solution. Here is what i have tried:

1. Parenting

I tried the "normal" parenting stuff addressing the QLabel to the VideoWidget.
Result: The label does not show up at all.

2. QStackedLayout

as suggested here: http://www.qtcentre.org/threads/31490-Overlaying-Widgets-on-top-of-VideoWidget.

Result: Label is shown but always behind the video

3. GraphicsView

I tried a lot here as it looked like the most promising, but at the end the CPU load was just too high so the video did not play back.
Setting the view's viewport to QGLWidget did not solve it.

Result: Overlay works but video does not play caused by high CPU load.

4. Subclassing the VideoWidget

As mentioned here https://wiki.qt.io/Overlay_widget_for_Phonon_VideoWidget i took the same approach to create the overlay.
This works just fine after all, except for the moveEvent. It does not look nice if the label is realigned after moving the widget has finished.
Is there a way to update this already when moving VideoWidget?

I really hope someone can help me here (i use PySide but examples in C++ should work as well) or give me a pointer on where to look at.
Please let me know if i should share some code snippet to reproduce.

Thanks,
René