Qt World Summit: Register Today!

Strange slider behavior

  • Hey ho Giggity,

    i´m stumbling in my way on Qt on an Android driven XPeria.
    Basicly i´m making up a very simple Apple to get a feeling for different kind of things.
    One of them is to give a slider a custom appearance by applying stylesheets
    S1->setStyleSheet("QSlider::groove:horizontal{border: 40px solid #800040; height: 10px; background: red; margin: 20px 0} QSlider::handle:horizontal{background: blue; margin: 70px; border 20px solid black; width: 70px; height: 70px}");

    What makes me wondering is that i can´t scroll the slider. It only moves, if i "double-klick" with my finger somewhere on the groove. Then the handle come over. But i can´t press the handle directly and move it.

    Does someone have a suggestion?

  • Ok, solved it my self.
    The stylesheet syntax was wrong. Actually i have little problems to figure out the mechanisms.

    This works:

    slider1->setGeometry(50, 370, 900, 140);

    slider1->setStyleSheet("QSlider::groove:horizontal{border: 20px solid #800040; height: 10px; background: red; margin: 90px 0} QSlider::handle:horizontal{background-color: green; border: 3px solid blue; width: 140px; border-radius: 3px; margin: -65px}");

Log in to reply