简体   繁体   English

Qt中的透明窗口

[英]Transparent window in Qt

How can I create a transparent window in Qt for Linux. 如何在Qt for Linux中创建透明窗口。 I tried the following, but it doesn't work: 我尝试了以下操作,但不起作用:

myWidget::myWidget(QWidget *parent) : QWidget(parent, Qt::FramelessWindowHint) {
   setWindowOpacity(0.4);
}

"Note that under X11 you need to have a composite manager running, and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be supported by the window manager you are using." “请注意,在X11下,您需要运行一个复合管理器,并且所使用的窗口管理器需要支持X11特定的_NET_WM_WINDOW_OPACITY原子。”

http://doc.qt.nokia.com/4.7/qwidget.html#windowOpacity-prop http://doc.qt.nokia.com/4.7/qwidget.html#windowOpacity-prop

What window manager are you using? 您正在使用什么窗口管理器? http://en.wikipedia.org/wiki/Compositing_window_manager#List_of_compositing_window_managers http://en.wikipedia.org/wiki/Compositing_window_manager#List_of_compositing_window_managers

Does your server support the "Composite extension"? 您的服务器是否支持“复合扩展”? http://en.wikipedia.org/wiki/Composite_(graphics ) http://en.wikipedia.org/wiki/Composite_(graphics

Does your card support it? 您的卡支持吗?

I had a similar issue but on windows, not sure if it will help in Linux Instead of Qt::FramelessWindowHint use Qt::SplashScreen. 我有一个类似的问题,但是在Windows上,不确定是否在Linux中会有所帮助,而不是Qt :: FramelessWindowHint,请使用Qt :: SplashScreen。 I can have a frameless and transparent window on top of my other widgets. 我可以在其他小部件之上有一个无框透明窗口。

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

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