Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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);