补充一下:
Qt assistant :
The palette's background color will only have an effect on the appearance of the widget if the autoFillBackground property is set true;
完整实现:
label->setAutoFillBackground (true);
QPalette palette;
palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(10), QColor(255,0,0));
label->setPalette(palette);
楼上说的在main函数的开始加上QApplication::setStyle(new QWindowsXPStyle);完全没必要。牛头不对马嘴!