Important: Please read the Qt Code of Conduct -

QxtSpanSlider weird issue, any other way to create a slider widget with 2 sliders?

  • Here is a screenshot


    Do you see that orange thing on the left? Why? This is the code i use

    @leon = new QxtSpanSlider(this);

    If it is not possible to fix this issue do you know any other way to create a slider widget with 2 sliders?

  • I had an issue that almost looked the same:

    I use the Fusion style and than the groove was colored highlighted on the left side of the lower handle. My slider has a minimum value below 0 and therefor I noticed it.

    This is an issue in the implementation of the QxtSpanSlider but only when a style is used that highlights a part of the groove. I solved it with next code change:

    @void QxtSpanSlider::paintEvent(QPaintEvent* event)
    QStylePainter painter(this);

    // groove & ticks
    QStyleOptionSlider opt;
    opt.sliderValue = qMin (0, minimum ());
    opt.sliderPosition = QStyle::sliderValueFromPosition (minimum (), maximum (), qMin (0, minimum ()), maximum () - minimum (), false);
    opt.subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderTickmarks;
    painter.drawComplexControl(QStyle::CC_Slider, opt);


    In this part the Groove and Ticks should be painted using the original Style. The Fusion style draws a highlighted part from the minimum till the handle.
    To prevent this I mimic the value of the slider to be equal to the minimum.


    (Qt 5.2.1 Qxt 0.7)

Log in to reply