标题:求助,关于qt控件背景透明
作者:qsrong
日期:2009-07-29 18:20
内容:
有谁知道qt下怎么实现例如Qlabel之类的控件背景透明吗,使其可以使用窗口的背景图片作为背景,
Qlabel用于显示png格式的图片切换,。
qt2.3.7版本;
#1 [shiroki 07-30 11:56]
如果没记错的话可以给label设成其parent一样的背景图片,然后用setBcakgroundOrigin
QWidget::BackgroundOrigin
This enum defines the origin used to draw a widget's background pixmap.
* WidgetOrigin - the pixmap is drawn in the widget's coordinate system.
* ParentOrigin - the pixmap is drawn in the parent's coordinate system.
#2 [mahui85 10-03 12:28]
可是我的背景不同区域背景颜色啥的不一样咋弄?请教楼上??
#3 [novesky 10-14 22:25]
这个问题我也考虑了很久,没想到什么办法。现在想到一个方案是在showEvent里截取parent或整个屏幕成pixmap,然后自己alpha混合下再设置成这个部件的背景。没试过