QPlainTextEdit Refuses to Change its Background Color (Qt / C++)

Viewed 98

I was trying to change the background color of a QPlainTextEdit widget to black and apply a glow effect to it. But when I apply a DropShadowEffect to a QTextEdit or a QPlainTextEdit widget, its background color reverts back to the original and refuses to change. I'm using Qt version 5.12.2. Here's the code:

#include <QtWidgets>

int main(int argc, char** argv)
{
    QApplication app(argc, argv);
    QMainWindow window;
    window.setWindowTitle("Title");
    window.setStyleSheet("QMainWindow{background-color: #191b21}");
    window.setFixedSize(800, 600);
    window.show();

    QPlainTextEdit* w = new QPlainTextEdit(&window);
    w->setGeometry(250, 50, 300, 50);
    w->setStyleSheet("QPlainTextEdit{background-color: black; color: white;}");
    QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect();
    effect->setColor("#59f1ff");
    effect->setBlurRadius(30);
    effect->setOffset(.0);
    w->setGraphicsEffect(effect);
    w->show();
    return app.exec();
}

I've tried using QPalette but it won't work too. What am I doing wrong?

0 Answers
Related