1,父窗口透明

// 设置背景图片

QPalette pa;

setAutoFillBackground(true);

pa.setBrush(QPalette::Background,QBrush(QPixmap("image/cloud.jpg")));

setPalette(pa);

//设置控制透明度

setWindowOpacity (0.7); // 半透明

2、控件透明

setAutoFillBackground(false);

setWindowFlags(Qt::FramelessWindowHint);

setAttribute(Qt::WA_TranslucentBackground, true);

然后重载paintEvent

用个带透明度的画刷填充就好了