Draw background of custom widget
I want to change the background color of my custom widget depending on the state of some property, but I want the widget to still be stylable using stylesheets. I understand that I should use QStylePainter in paintEvent, but I can't figure out which draw method to use (I must be stupid).
Code:
{
option.initFrom(this);
switch (this->m_someProperty) {
case 0:
color
= QColor::fromRgb(255,
255,
255);
break;
case 1:
color
= QColor::fromRgb(211,
211,
211);
break;
}
painter. //What to use here?
}
Thanks.