首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > QT开发 >

QT 父控件设置为透明背景后,如何设置子控件的透明度

2013-07-01 
QT 父控件设置为透明背景后,怎么设置子控件的透明度使用 setWindowOpacity 无效果重写 paintEvent 可以实

QT 父控件设置为透明背景后,怎么设置子控件的透明度
使用 setWindowOpacity 无效果

重写 paintEvent 可以实现这个效果,但控件样式较多,自己绘制比较麻烦

setStyleSheet 可不可以,只改变透明度,不影响其他外观

[解决办法]
setWindowOpacity 可以啊  除非你是在linux上
[解决办法]
看看Qt::WA_TranslucentBackground的解释

Indicates that the widget should have a translucent background, i.e., any non-opaque regions of the widgets will be translucent because the widget will have an alpha channel. Setting this flag causes WA_NoSystemBackground to be set. On Windows the widget also needs the Qt::FramelessWindowHint window flag to be set. This flag is set or cleared by the widget's author.
[解决办法]
paintEvent如何让控件透明啊

热点排行