Qt stylesheet in derived class in C++ namespace (selector)
I want to use my global qss stylesheet with a derived class. I understand I have to override the paintEvent ( style sheet reference , or here ). void CustomWidget::paintEvent(QPaintEvent *) { QStyleOption opt; opt.init(this); // tried initFrom too, same result=>not working QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); } However, it does not seem to work. With CDerived:QWidget and the following style sheet lines I face: CDerived { background-color: black; } // no effect QWidget { background-color: black; } // works CDerived implements paintEvent as above. Anything