Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QxtSpanSlider weird issue, any other way to create a slider widget with 2 sliders?
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Tabula
      wrote on last edited by
      #2

      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)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved