开发者

Transparent window in Qt

How can I create a transparent window in Qt for Linux. I tried the following, but it doesn't work:

myWidget::myWidget(QWidget *parent) : QWidget(parent, Qt::FramelessWindowHint) {
   setWindowOpac开发者_开发知识库ity(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."

https://doc.qt.io/qt-5/qwidget.html#windowOpacity-prop

What window manager are you using? 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)

Does your card support it?


Try to use QGraphicsOpacityEffect and QWidget::setGraphicsEffect


I had a similar issue but on windows, not sure if it will help in Linux Instead of Qt::FramelessWindowHint use Qt::SplashScreen. I can have a frameless and transparent window on top of my other widgets.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜