CSS, QSlider, set background, handle not visible anymore
-
Hi,
i have the following code:
@CustomSlider::CustomSlider(QWidget *parent) :
QSlider(parent)
{
QObject::connect(this, SIGNAL(sliderMoved(int)), this, SLOT(valueChanged(int)));
}void CustomSlider::valueChanged(int value)
{
int c = (int)(2.55*value);
QString stylesheet = "QSlider::groove:horizontal { background: rgba(" + QString::number(c) + ", 0, 0, " + QString::number(c) + ");}";
this->setStyleSheet(stylesheet);
}@I want the slider to change the background color depending on the current value of the slider. The higher the value, the more red i want the background to be. The color changing effect works, except the handle is not visible anymore. This makes no sense to me, because i really just set the background of the slider, which should not effect the handle or the visibility of the handle.
I think i miss something essential but i can't figure out what. I have no idea why setting the background color of a slider changes the handle to not visible.
Can someone give me some hints why this is happening and how i can avoid it? Thanks in advance!