Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QtControls.slider.value returns with decimal points when moved.
QtWS25 Last Chance

QtControls.slider.value returns with decimal points when moved.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 323 Views
  • 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.
  • M Offline
    M Offline
    Makarand_EB
    wrote on last edited by Makarand_EB
    #1

    I am using a Slider with below properties set for it -

    Item {
    id: root
    signal sliderMoved
    property alias value: control.value

    QtControls.Slider {
    orientation: Qt.Vertical
    snapMode: QtControls.Slider.SnapOnRelease
    from: 59.0
    to: 86.0
    stepSize : 1.0
    onMoved: root.sliderMoved()
    }
    }

    From user QML where this slider is used thru loader

    Connections {
    target: sliderLoader.item
    onSliderMoved: {
    console.warn(sliderLoader.item.value);
    }
    }

    But eachtime when the slider is dragged, it returns the value with decimal points. I am expecting value like 59,60,61, 62.....till 86 not like 59.12, 63.45 etc. How to get rid of these decimal points from the returned slider value when the slider is moved

    ODБOïO 1 Reply Last reply
    0
    • M Makarand_EB

      I am using a Slider with below properties set for it -

      Item {
      id: root
      signal sliderMoved
      property alias value: control.value

      QtControls.Slider {
      orientation: Qt.Vertical
      snapMode: QtControls.Slider.SnapOnRelease
      from: 59.0
      to: 86.0
      stepSize : 1.0
      onMoved: root.sliderMoved()
      }
      }

      From user QML where this slider is used thru loader

      Connections {
      target: sliderLoader.item
      onSliderMoved: {
      console.warn(sliderLoader.item.value);
      }
      }

      But eachtime when the slider is dragged, it returns the value with decimal points. I am expecting value like 59,60,61, 62.....till 86 not like 59.12, 63.45 etc. How to get rid of these decimal points from the returned slider value when the slider is moved

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      hi,

      @Makarand_EB said in QtControls.slider.value returns with decimal points when moved.:

      stepsize : 1.0

      stepSize : 1 // note the uppercase "S"

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Makarand_EB
        wrote on last edited by
        #3

        Thanks, I update the code.

        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