Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-42358

Slider: a custom handle with an even width will never reach 100

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.6.0 RC
    • 5.4.0 Beta
    • Quick: Controls 1
    • None
    • 32d11f2d679b811c9af349fe9f0b0b29d4f598c0

      When running the following example, slide the handle to the far right. The value printed out will get to 99.99999999999999 but never 100.

      import QtQuick 2.3
      import QtQuick.Window 2.2
      import QtQuick.Controls 1.2
      import QtQuick.Controls.Styles 1.2
      
      Window {
          width: 800
          height: 400
          visible: true
      
          Slider {
              id: slider
              width: parent.width
              minimumValue: 0
              maximumValue: 100 // only happens for 100, not any other even number
              onValueChanged: print(value)
      
              style: SliderStyle {
                  handle: Rectangle {
                      implicitHeight: 26 // an odd number here will work
                      implicitWidth: 26
                      color: "salmon"
                  }
              }
          }
      
          Text {
              text: slider.value
              anchors.centerIn: parent
          }
      }
      

      The odd thing is that the Text item displays the correct value (100).

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Eddy Edward Welbourne
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes