Qt参考文档
Platform notes:
X11: This feature relies on the use of an X server that supports ARGB visuals and a compositing window manager.
Windows: The widget needs to have the Qt::FramelessWindowHintwindow flag set for the translucency to work.
平台注意事项:
X11(linux):此特性依赖于能提供支持ARGB视觉效果和复合式视窗管理的X服务的功能开启。
Windows:此控件需要设置窗口标志Qt::FramelessWindowHint才能开启透明功能。
在windows上设置widget属性
setWindowFlags(Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground,true);
可以实现透明功能,但是在linux上需要安装渲染工具compiz 方法如下:
root用户下: yum install compiz
运行:compiz --replace &