How do I set the background color of a widget like combobox or double spin box?

fhe is generally correct, but doesn’t account for the widgets (like spin boxes and buttons/comboboxes) that use a different background role in the palette. A more general solution would be something like this: QPalette pal = widget.palette(); pal.setColor(widget.backgroundRole(), Qt::blue); widget.setPalette(pal); Alternatively, you could look into the descriptions of the various palette roles and figure out … Read more