Search code examples
c++qtqt4stylesheetqt-designer

Qt Designer and stylesheets


I have derived a CalibrationWindow from QWidget, and I have a vector of CalibrationWindow*. Now, I'm trying to change the background color in the Designer with the following stylesheet:

#calibrationWindow
{
    background : rgb(220, 220, 220);
}

(The Qt object name is calibrationWindow). In the Designer, it looks as intended, but when I run the program, zilch. No effect whatsoever. I also tried using CalibrationWindow instead of #calibrationWindow, to no avail. I even put QWidget, but it affects the child widgets and not the parent, as I want.

Could anyone help? Thanks.


Solution

  • Sorry, I was not overriding the paintEvent() function... It's compulsory when subclassing from QWidget.