无法在 LibVLC 使用的 QWidget 上覆盖透明的 Qlabel [英] Can not overlay a transparent Qlabel on a QWidget that LibVLC uses

查看:151
本文介绍了无法在 LibVLC 使用的 QWidget 上覆盖透明的 Qlabel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 LibVLC 用户有一个问题,我一直在苦苦挣扎,但还没有找到解决方案,所以想向您寻求帮助.

I have a question to LibVLC users that I have been struggling all day but couldn't come to a solution yet, so wanted to ask you for help.

我有一个 Qt 应用程序,它使用 LibVLC 播放视频、视频流.您可能知道,LibVLC 使用 Qt 小部件通过仅获取 Qwidget 的 WinID 来呈现视频帧,并自行处理其余部分.我有一个 Qwidget 用 LibVLC 渲染视频,我想在这个小部件上覆盖一个透明的 Qlabel,但是当小部件开始显示视频时,标签不能是透明的,并保持背景与它在覆盖之前的最后一件事视频开始播放.

I have a Qt application that uses LibVLC to play videos, video streams. As you may know, LibVLC uses Qt widgets to render video frames by getting only the WinID of the Qwidget and handles the rest itself. I have a Qwidget to render video with LibVLC and I want to overlay a transparent Qlabel on this widget but when the widget starts showing the video, the label can not be transparent and stays with a background with the very last thing it was overlaying before the video starts to play.

这对我来说是一个 LibVLC 问题,我确信有一个解决方案,但目前在网上找不到解决方法.

This is a LibVLC issue to me and I am sure there is a solution but couldn't find a work around on the net so far.

任何建议为什么会发生这种情况以及如何避免?

Any suggestions why this happens and how to avoid?

提前致谢.

推荐答案

将这些属性和标志添加到所需的 Qlabel 解决了我的问题.

adding these attribute and flag to the desired Qlabel solved my problem.

labelCamName->setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
labelCamName->setAttribute(Qt::WA_TranslucentBackground);

这篇关于无法在 LibVLC 使用的 QWidget 上覆盖透明的 Qlabel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆