internal: fix crash

This commit is contained in:
2 * r + 2 * t 2025-09-12 19:17:35 +10:00
parent 297df9bca1
commit 56f6150ec9

View file

@ -69,7 +69,7 @@ Slider {
function update(): void { function update(): void {
animate = !moving; animate = !moving;
text = moving ? Qt.binding(() => Math.round(root.value * 100)) : Qt.binding(() => root.icon); binding.when = moving;
font.pointSize = moving ? Appearance.font.size.small : Appearance.font.size.larger; font.pointSize = moving ? Appearance.font.size.small : Appearance.font.size.larger;
font.family = moving ? Appearance.font.family.sans : Appearance.font.family.material; font.family = moving ? Appearance.font.family.sans : Appearance.font.family.material;
} }
@ -78,12 +78,23 @@ Slider {
color: Colours.palette.m3inverseOnSurface color: Colours.palette.m3inverseOnSurface
anchors.centerIn: parent anchors.centerIn: parent
Behavior on moving { onMovingChanged: anim.restart()
Binding {
id: binding
target: icon
property: "text"
value: Math.round(root.value * 100)
when: false
}
SequentialAnimation { SequentialAnimation {
id: anim
Anim { Anim {
target: icon target: icon
property: "scale" property: "scale"
from: 1
to: 0 to: 0
duration: Appearance.anim.durations.normal / 2 duration: Appearance.anim.durations.normal / 2
easing.bezierCurve: Appearance.anim.curves.standardAccel easing.bezierCurve: Appearance.anim.curves.standardAccel
@ -94,7 +105,6 @@ Slider {
Anim { Anim {
target: icon target: icon
property: "scale" property: "scale"
from: 0
to: 1 to: 1
duration: Appearance.anim.durations.normal / 2 duration: Appearance.anim.durations.normal / 2
easing.bezierCurve: Appearance.anim.curves.standardDecel easing.bezierCurve: Appearance.anim.curves.standardDecel
@ -103,7 +113,6 @@ Slider {
} }
} }
} }
}
onPressedChanged: handle.moving = pressed onPressedChanged: handle.moving = pressed