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



  • Here is a screenshot

    !http://i.imgur.com/H3DJF.png(1)!

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

    @leon = new QxtSpanSlider(this);
    leon->setFocusPolicy(Qt::NoFocus);
    leon->setOrientation(Qt::Horizontal);
    leon->setUpperPosition(8);
    leon->setLowerPosition(6);
    leon->setMaximum(16);
    leon->setGeometry(QRect(0,0,350,100));@

    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)
    {
    Q_UNUSED(event);
    QStylePainter painter(this);

    // groove & ticks
    QStyleOptionSlider opt;
    qxt_d().initStyleOption(&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.

    Regards,

    (Qt 5.2.1 Qxt 0.7)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.