Reputation: 21
I have QLabel and I want to make it transparent(semi-transparent actually). The only thing that works for me is setWindowOpacity(0.5)
. But it makes text transparent too.
I've tried:
setStyleSheet("QWidget{background-color: transparent;}")
setStyleSheet("background-color: rgba(0,0,0,0)")
setAttribute(Qt::WA_TranslucentBackground, true);
setAttribute( Qt::WA_OpaquePaintEvent, true );
But window becomes black and i have no idea why. My os windows 10 x64.
Upvotes: 0
Views: 1770
Reputation: 21
I added this->setWindowFlags(Qt::FramelessWindowHint);
And now this->setAttribute(Qt::WA_TranslucentBackground, true);
works.
Upvotes: 2