RangeSlider stepSize and wheel doesn't work
-
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 } }
-
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 } }
@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)? -
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:
-
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:
@raga
also trysnapMode: RangeSlider.SnapAlways
-
@raga
just tried your code with the snapMode property and it works like you want it to
(Qt 5.15.2) -
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!
-
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!
@raga
i dont understand your last post.For the
orientation
property this is the wrong enum.
And for thesnapMode
property shouldn't allow to accept string values.Asi wrote it should be
snapMode: RangeSlider.SnapAlways
-
Sorry for the bad explanation. I record a video. I hope it will be clear.
Youtube video link is here. -
Sorry for the bad explanation. I record a video. I hope it will be clear.
Youtube video link is here.@raga
seems that this is a bug in QtCretaor's designer inserting the chosen value o nthe orientation property.
change it manually tosnapMode: RangeSlider.SnapAlways
and it works as i tested it.