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.
精彩评论