Hi! I'm trying to paint a scrollbar in a QGraphicsItem by calling QStyle::drawComplexControl(). It works like a charm for vertical scrollbars. However, it doesn't work properly for horizontal scrollbars in some styles, especially in the oxygen style.
I have made a simple test case by reimplementing QWidget::paintEvent(). This is what I do:
Code:
{ QStyleOptionSlider option; option.minimum = 0; option.maximum = 50; option.orientation = Qt::Horizontal; option.pageStep = 10; option.singleStep = 1; option.sliderPosition = 0; option.sliderValue = 0; event->accept(); }
Am I missing something? Should I do it in a different way?
Notice in the screenshots how it's totally screwed up in the Oxygen style while it displays fine in Plastique. In Windows, the buttons show up/down arrows instead of left/right arrows. If you change it to Qt::Vertical (and give a proper size) it displays fine in all those styles.
Added after 13 minutes:
I answer to myself: I had to add QStyle::State_Horizontal to the state.