开发者

QWidget per-pixel translusency

I'm looking at making a QWidget partially transluscent.

QWidget::setMask can set a per-pixel transparency, like this, but it's either-or: not transluscent.

QWidget::opacity can set a global transluscency, but it's not per-pixel.

How can I get the best开发者_如何学Python of both worlds and add a per-pixel alpha channel to the whole widget? (Decorations don't matter.)


Maybe QWidget::setMaks()?

QLabel topLevelLabel;
QPixmap pixmap(":/images/tux.png");
topLevelLabel.setPixmap(pixmap);
topLevelLabel.setMask(pixmap.mask());


It looks like the QStyle class is what you might be looking for, esp. QStyle::drawItemPixmap; then use QWidget::setStyle(). Never used this myself though.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜