0

I am trying to make QWidget transparent background, but all the codes I found here gave me black background altho it gives me a transparent background when I use it with MainWindow object but not Qwidget object!

some codes I used

  q->setAttribute(Qt::WA_TranslucentBackground, true);
  q->setAttribute(Qt::WA_NoSystemBackground);
  q->setAttribute(Qt::WA_OpaquePaintEvent);
  q->setAttribute(Qt::WA_NoBackground);
  q->setStyleSheet("background:transparent;");

and yes q is an QWidget object

  • 2
    Please provide a [mcve]. You might also want to provide information about your platform, `Qt` version etc. – G.M. May 19 '22 at 09:31
  • 1
    Mybe you find your answer [here](https://stackoverflow.com/questions/25466030/make-qwidget-transparent) – Tim May 19 '22 at 15:38
  • Do you want to show a transparent toplevel window? Or what exactly do you want to achieve? – E4z9 May 20 '22 at 08:28

0 Answers0