0

I have a label in my main window that displays some text. I also have a background image in the main window that needs to show through the label. Only the background and the text should be visible.

I've set the alpha to zero with a white label background following the instructions I found on SO (here and here).

label->setStyleSheet("background-color: rgba(255, 255, 255, 0);");

However, I still see a dark box.

Community
  • 1
  • 1
user4261180
  • 151
  • 2
  • 3
  • 11

1 Answers1

0

You should set your main window transparent by adding these to the constructor of your main window :

setAttribute(Qt::WA_NoSystemBackground);
setAttribute(Qt::WA_TranslucentBackground);

You can also create a borderless dialog by setting Qt::FramelessWindowHint window flag :

setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
Nejat
  • 31,784
  • 12
  • 106
  • 138