Reputation: 1788
I placed background image like this:
setWindowFlags(Qt::FramelessWindowHint);
QPixmap slika("some_image.png");
QPalette paleta;
paleta.setBrush(this->backgroundRole(), QBrush(slika));
this->setPalette(paleta);
If I make this picture transparent, when application loads, it will only blink and disappear. But if I make this image with no transparency, then everything is ok. Why Qt refuses to use transparent image?
Upvotes: 1
Views: 2946
Reputation: 858
I don't know what is your use case for this, but you can also try using setStyleSheet
method to make background transparent.
setStyleSheet("background:transparent;");
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(Qt::FramelessWindowHint);
Hope this helps.
Upvotes: 1