How do I use paintEvent on a QVideoWidget with transparency?

201 views Asked by At

I'm working on qt5 (C +). I use QVideoWidget to play rtsp video stream. I wanted to draw any signatures with QPainter on the displayed video. However, I obscure the video while drawing. For example, as for the drawing area, I have given half of the QVideoWidget image.

example used:
example used

Tried adding an extra QLabel on QVideoWidget:

QLabel * label = new QLabel (ui-> videoWidget);

And then draw on the "label", but also cover the QVideoWidget.

I also added:

ui-> videoWidget-> setAttribute (Qt :: WA_X11OpenGLOverlay);

But then the transparency extends all the way to the desktop of the operating system.

1

There are 1 answers

0
Yann Kergutuil On

Try to set the transparency of the item that you want to draw and not the transparency of the QVideoWidget.