Moving to a frameless and semi-transparent window from a function

I am trying to change the style of a window to a frameless window with a drop shadow. It only worked when I put this code in designer windows, but when this code is placed in the Clicked function it doesn't work: MainWindow is not semi-transparent. Code:

ui->widget->setAutoFillBackground(true);

setAttribute(Qt::WA_TranslucentBackground); 
setWindowFlags(Qt::FramelessWindowHint);

QGraphicsDropShadowEffect *bodyShadow = new QGraphicsDropShadowEffect;
bodyShadow->setBlurRadius(10.0);
bodyShadow->setColor(QColor(0,0 , 0, 120));
bodyShadow->setOffset(0,0);

ui->widget->setGraphicsEffect(bodyShadow);

this->show();

      

+3


source to share





All Articles