This is my code, where WWidget inherits from QWidget:
typedef QRgb COLOR;
void
WWidget::Widget_UpdateColorBackground(COLOR coBackground)
{
QPalette oPalette(palette()); // Make a copy of the current palette
oPalette.setColor(QPalette::Base, coBackground);
setPalette(oPalette);
}