简体   繁体   English

如何在具有透明度的 QVideoWidget 上使用paintEvent?

[英]How do I use paintEvent on a QVideoWidget with transparency?

I'm working on qt5 (C +).我正在研究 qt5 (C +)。 I use QVideoWidget to play rtsp video stream.我使用 QVideoWidget 播放 rtsp 视频 stream。 I wanted to draw any signatures with QPainter on the displayed video.我想用 QPainter 在显示的视频上绘制任何签名。 However, I obscure the video while drawing.但是,我在绘画时模糊了视频。 For example, as for the drawing area, I have given half of the QVideoWidget image.例如,关于绘图区域,我给出了 QVideoWidget 图像的一半。

example used:使用的示例:
使用的示例

Tried adding an extra QLabel on QVideoWidget:尝试在 QVideoWidget 上添加额外的 QLabel:

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

And then draw on the "label", but also cover the QVideoWidget.然后在“标签”上绘制,还覆盖了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.尝试设置要绘制的项目的透明度,而不是 QVideoWidget 的透明度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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