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. RangeSlider stepSize and wheel doesn't work
Forum Updated to NodeBB v4.3 + New Features

RangeSlider stepSize and wheel doesn't work

Scheduled Pinned Locked Moved Solved QML and Qt Quick
10 Posts 2 Posters 987 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.
  • R Offline
    R Offline
    raga
    wrote on last edited by
    #1

    Hello,
    I am trying to use rangeSlider in my application. I have already used slider with both wheel enabled and stepSize needed. However, rangeSlider doesn't responded as I expected. Thus, my question is why the stepSize and wheel enabling doesn't work on my project? I also create a new, simple project and the result is same.

    Code is below:

    import QtQuick 2.15
    import QtQuick.Window 2.15
    import QtQuick.Controls 2.15
    
    Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
    
        RangeSlider {
            id: rangeSlider
            wheelEnabled: true
            to: 3
            from: 0
            stepSize: 1
            first.value: 0
            second.value: 3
        }
    }
    
    raven-worxR 1 Reply Last reply
    0
    • R raga

      Hello,
      I am trying to use rangeSlider in my application. I have already used slider with both wheel enabled and stepSize needed. However, rangeSlider doesn't responded as I expected. Thus, my question is why the stepSize and wheel enabling doesn't work on my project? I also create a new, simple project and the result is same.

      Code is below:

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.15
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          RangeSlider {
              id: rangeSlider
              wheelEnabled: true
              to: 3
              from: 0
              stepSize: 1
              first.value: 0
              second.value: 3
          }
      }
      
      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @raga said in RangeSlider stepSize and wheel doesn't work:

      However, rangeSlider doesn't responded as I expected

      what is your expectation? and how does it differ?
      What Qt platform(-plugin)?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • R Offline
        R Offline
        raga
        wrote on last edited by raga
        #3

        My expectation is the step size to be 1 but it remains real values. I add text to print first and second values. I am using qt creator 4.14.1 and Qt 5.15.2.

        import QtQuick 2.15
        import QtQuick.Window 2.15
        import QtQuick.Controls 2.15
        
        Window {
            id: window
            width: 640
            height: 480
            visible: true
            title: qsTr("Hello World")
        
            RangeSlider {
                id: rangeSlider
                anchors.horizontalCenter: parent.horizontalCenter
                wheelEnabled: true
                to: 3
                from: 0
                stepSize: 1
                first.value: 1
                second.value: 2
            }
        
            Text {
                id: text1
                x: 288
                y: 61
                width: 80
                height: 23
                text: rangeSlider.first.value + " - " + rangeSlider.second.value
                font.pixelSize: 12
                anchors.horizontalCenter: parent.horizontalCenter
            }
        }
        

        Result:

        Screenshot from 2021-05-11 19-35-12.png

        raven-worxR 1 Reply Last reply
        0
        • R raga

          My expectation is the step size to be 1 but it remains real values. I add text to print first and second values. I am using qt creator 4.14.1 and Qt 5.15.2.

          import QtQuick 2.15
          import QtQuick.Window 2.15
          import QtQuick.Controls 2.15
          
          Window {
              id: window
              width: 640
              height: 480
              visible: true
              title: qsTr("Hello World")
          
              RangeSlider {
                  id: rangeSlider
                  anchors.horizontalCenter: parent.horizontalCenter
                  wheelEnabled: true
                  to: 3
                  from: 0
                  stepSize: 1
                  first.value: 1
                  second.value: 2
              }
          
              Text {
                  id: text1
                  x: 288
                  y: 61
                  width: 80
                  height: 23
                  text: rangeSlider.first.value + " - " + rangeSlider.second.value
                  font.pixelSize: 12
                  anchors.horizontalCenter: parent.horizontalCenter
              }
          }
          

          Result:

          Screenshot from 2021-05-11 19-35-12.png

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @raga
          also try snapMode: RangeSlider.SnapAlways

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • R Offline
            R Offline
            raga
            wrote on last edited by
            #5

            Didn't worked.

            raven-worxR 1 Reply Last reply
            0
            • R raga

              Didn't worked.

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by raven-worx
              #6

              @raga
              just tried your code with the snapMode property and it works like you want it to
              (Qt 5.15.2)

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              0
              • R Offline
                R Offline
                raga
                wrote on last edited by
                #7

                I just realized interesting thing. When I add snap mode by using text editor, it works. However, when I activate snap mode by using property section of the design mode of the Qt Creator, it doesn't work. When I change snap mode the code is changed as below:

                orientation: RangeSlider.SnapAlways
                

                When I just simply add snap mode as below, it works.

                snapMode: "SnapAlways"
                

                Thank you!

                raven-worxR 1 Reply Last reply
                0
                • R raga

                  I just realized interesting thing. When I add snap mode by using text editor, it works. However, when I activate snap mode by using property section of the design mode of the Qt Creator, it doesn't work. When I change snap mode the code is changed as below:

                  orientation: RangeSlider.SnapAlways
                  

                  When I just simply add snap mode as below, it works.

                  snapMode: "SnapAlways"
                  

                  Thank you!

                  raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by
                  #8

                  @raga
                  i dont understand your last post.

                  For the orientation property this is the wrong enum.
                  And for the snapMode property shouldn't allow to accept string values.

                  Asi wrote it should be snapMode: RangeSlider.SnapAlways

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    raga
                    wrote on last edited by
                    #9

                    Sorry for the bad explanation. I record a video. I hope it will be clear.
                    Youtube video link is here.

                    raven-worxR 1 Reply Last reply
                    0
                    • R raga

                      Sorry for the bad explanation. I record a video. I hope it will be clear.
                      Youtube video link is here.

                      raven-worxR Offline
                      raven-worxR Offline
                      raven-worx
                      Moderators
                      wrote on last edited by
                      #10

                      @raga
                      seems that this is a bug in QtCretaor's designer inserting the chosen value o nthe orientation property.
                      change it manually to snapMode: RangeSlider.SnapAlways and it works as i tested it.

                      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                      If you have a question please use the forum so others can benefit from the solution in the future

                      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