Make the slider label width adjustable depending on the number of digits of

the total number of layers.
This commit is contained in:
Diego Prado Gesto 2018-06-12 13:32:54 +02:00
parent c31d329657
commit 7cd0f57f22

View file

@ -53,7 +53,7 @@ UM.PointingRectangle {
verticalCenter: parent.verticalCenter
}
width: 40 * screenScaleFactor
width: maximumValue.toString().length * 10 * screenScaleFactor
text: sliderLabelRoot.value + startFrom // the current handle value, add 1 because layers is an array
horizontalAlignment: TextInput.AlignRight
@ -77,11 +77,12 @@ UM.PointingRectangle {
if (valueLabel.text != "") {
// -startFrom because we need to convert back to an array structure
sliderLabelRoot.setValue(parseInt(valueLabel.text) - startFrom)
}
}
validator: IntValidator {
bottom:startFrom
bottom: startFrom
top: sliderLabelRoot.maximumValue + startFrom // +startFrom because maybe we want to start in a different value rather than 0
}
}