The approach you are taking is the correct one.What is the recommended way of setting the background color of a button, or a widget in general, that will work everywhere?
But it could be that there is issue with the roles.
Try to play with the color roles.
If what you want is background, try using QPalette::Window and not QPalette::Button for example.
It probably has to do with the following:
The general button background color. This background can be different from Window as some styles require a different background color for buttons.
Bookmarks