简体   繁体   中英

How do I use paintEvent on a QVideoWidget with transparency?

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:
使用的示例

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM