Can't add shadow to frameless window



  • How to add a full shadow to MainWindow or centralwidget?

    I already use this
    Not work for me =
    and also try different flags:

    setAttribute(Qt::WA_TranslucentBackground); //enable MainWindow to be transparent
    setMask(geometry());
            this->setWindowFlags(Qt::SplashScreen); //enable MainWindow to be transparent
            this->setWindowFlags( Qt::FramelessWindowHint); //enable MainWindow to be transparent
    

    and also show()
    and apply shadow effect

        CustomShadowEffect* shadowEffect = new CustomShadowEffect();
        shadowEffect->setBlurRadius(9.0);
        shadowEffect->setDistance(6.0);
        shadowEffect->setColor(QColor(0, 0, 0, 80));
        this->centralWidget->setAutoFillBackground(true);
        this->centralWidget->setGraphicsEffect(shadowEffect);
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.