I use the follow code to set the background color of a a QLabel:
Qt Code:
  1. QColor colorrgb(x*255,y*255,z*255);
  2. QPalette plalette;
  3. plalette.setColor(QPalette::Window,colorrgb);
  4. colorlabelreal->setAutoFillBackground(true);
  5. colorlabelreal->setPalette(plalette);
To copy to clipboard, switch view to plain text mode 

but the follow error occur:
error C2039: 'hwnd' : is not a member of QPalette
error C2275: 'HWND' : illegal use of this type as an expression