我想改变滑块的背景颜色。尝试过以下代码,但是整个滑块的颜色都被覆盖了。这段代码在继承自QSlider的类中使用。
void paintEvent(QPaintEvent *e) {
QPainter painter(this);
painter.begin(this);
painter.setBrush(/*not important*/);
// This covers up the control. How do I make it so the color is in
// the background and the control is still visible?
painter.drawRect(rect());
painter.end();
}