Important: Please read the Qt Code of Conduct -

Qt.labs.controls in Qt5.6 beta Slider, stepSize, snapMode

  • Hi,

    I am very intrested in using the new qt quick controls and I found some behavior of the slider thats maybe a bug. Can somebody confirm that i use it right and made no mistake there.

    If I set the from an to value on the slider and the stepSize I am not able to drag the silder to the values of the stepSize, but the increase() and decrease() methods work correctly.

    I got the values from 0.0 / 0.4 / 0.8 / 1.2 / 1.6 / 2.0 by draging the handle but the values 0.0 / 0.2 / 0.4 / 0.6 / 0.8 / 1.0 / 1.2 / 1.4 / 1.6 / 1.8 / 2.0 by using the increase() and decrease() methods.

    andd If iset the snapMode to default (Slider.NoSnap) I can set any value by draging the handle ignoring the stepSize.

    the qml

    import QtQuick 2.6
    import Qt.labs.controls 1.0
    Button {
    	id: minus
    	text: "-"
    	onClicked: sliderOne.decrease()
    Slider {
    	id: sliderOne
    	from: 0.0
    	to: 2.0
    	stepSize: 0.2
    	snapMode: Slider.SnapOnRelease
    Button {
    	id: plus
    	text: "+"
    	onClicked: sliderOne.increase()
    Label {
    	id: sliderOneValue
    	text: sliderOne.value

  • Yes, it looks like a bug. Thank you for bringing this up - I'll take a look.

  • A fix has landed to the 5.6 branch, and will be released in Qt 5.6.1. Meanwhile, as a workaround, use a range of [0.0..1.0] and do the multiplication where the value is used.

  • @jpnurmi Hello, good to see Qt developers on these forums.
    Does 5.6 branch of Qt Quick Controls 2 have any dependencies (in case i use it with Qt 5.6.0 RC/release packages)?

  • We will push only stabilizing bug fixes to the 5.6 branch, so it will stay compatible with the 5.6.0 RC/release packages. All new features are pushed to the dev/5.7 branch. Technically 5.7 is already feature frozen when the branch gets created, but modules previously stamped as tech previews have an exception so we can continue the development full speed. We still got plenty of things to do before we have earned the final stamp. :)