mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 08:36:04 +08:00
CURA-4606 corrected slider bar, it now updates correctly from 0 available qualities to 1 available quality
This commit is contained in:
parent
85f3b7dcee
commit
01071da4c1
@ -137,7 +137,7 @@ Item
|
|||||||
|
|
||||||
// Set total available ticks for active slider part
|
// Set total available ticks for active slider part
|
||||||
if (availableMin != -1) {
|
if (availableMin != -1) {
|
||||||
qualityModel.availableTotalTicks = availableMax - availableMin
|
qualityModel.availableTotalTicks = availableMax - availableMin + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate slider values
|
// Calculate slider values
|
||||||
@ -164,7 +164,7 @@ Item
|
|||||||
|
|
||||||
function reset () {
|
function reset () {
|
||||||
qualityModel.clear()
|
qualityModel.clear()
|
||||||
qualityModel.availableTotalTicks = -1
|
qualityModel.availableTotalTicks = 0
|
||||||
qualityModel.existingQualityProfile = 0
|
qualityModel.existingQualityProfile = 0
|
||||||
|
|
||||||
// check, the ticks count cannot be less than zero
|
// check, the ticks count cannot be less than zero
|
||||||
@ -273,32 +273,24 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: disabledHandleButton
|
|
||||||
visible: !qualitySlider.visible
|
|
||||||
anchors.centerIn: parent
|
|
||||||
color: UM.Theme.getColor("quality_slider_unavailable")
|
|
||||||
implicitWidth: 10 * screenScaleFactor
|
|
||||||
implicitHeight: implicitWidth
|
|
||||||
radius: Math.round(width / 2)
|
|
||||||
}
|
|
||||||
|
|
||||||
Slider
|
Slider
|
||||||
{
|
{
|
||||||
id: qualitySlider
|
id: qualitySlider
|
||||||
height: UM.Theme.getSize("sidebar_margin").height
|
height: UM.Theme.getSize("sidebar_margin").height
|
||||||
anchors.bottom: speedSlider.bottom
|
anchors.bottom: speedSlider.bottom
|
||||||
enabled: qualityModel.availableTotalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized
|
enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized
|
||||||
visible: qualityModel.totalTicks > 0
|
visible: qualityModel.availableTotalTicks > 0
|
||||||
updateValueWhileDragging : false
|
updateValueWhileDragging : false
|
||||||
|
|
||||||
minimumValue: qualityModel.qualitySliderAvailableMin >= 0 ? qualityModel.qualitySliderAvailableMin : 0
|
minimumValue: qualityModel.qualitySliderAvailableMin >= 0 ? qualityModel.qualitySliderAvailableMin : 0
|
||||||
maximumValue: qualityModel.qualitySliderAvailableMax >= 0 ? qualityModel.qualitySliderAvailableMax : 0
|
// maximumValue must be greater than minimumValue to be able to see the handle. While the value is strictly
|
||||||
|
// speaking not always correct, it seems to have the correct behavior (switching from 0 available to 1 available)
|
||||||
|
maximumValue: qualityModel.qualitySliderAvailableMax >= 1 ? qualityModel.qualitySliderAvailableMax : 1
|
||||||
stepSize: 1
|
stepSize: 1
|
||||||
|
|
||||||
value: qualityModel.qualitySliderActiveIndex
|
value: qualityModel.qualitySliderActiveIndex
|
||||||
|
|
||||||
width: qualityModel.qualitySliderStepWidth * qualityModel.availableTotalTicks
|
width: qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks - 1)
|
||||||
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: qualityModel.qualitySliderMarginRight
|
anchors.rightMargin: qualityModel.qualitySliderMarginRight
|
||||||
@ -376,7 +368,7 @@ Item
|
|||||||
|
|
||||||
text: catalog.i18nc("@label", "Slower")
|
text: catalog.i18nc("@label", "Slower")
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
color: (qualityModel.availableTotalTicks > 0) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
color: (qualityModel.availableTotalTicks > 1) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +379,7 @@ Item
|
|||||||
|
|
||||||
text: catalog.i18nc("@label", "Faster")
|
text: catalog.i18nc("@label", "Faster")
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
color: (qualityModel.availableTotalTicks > 0) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
color: (qualityModel.availableTotalTicks > 1) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
||||||
horizontalAlignment: Text.AlignRight
|
horizontalAlignment: Text.AlignRight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user