action center: scrollable quick sliders (#2536)

This commit is contained in:
end-4
2025-11-21 22:18:56 +01:00
parent 35a1f7906a
commit fbfb81c83b
2 changed files with 19 additions and 1 deletions
@@ -33,6 +33,7 @@ ColumnLayout {
WSlider {
Layout.fillWidth: true
value: root.brightnessMonitor?.brightness ?? 0
scrollable: true
onMoved: {
root.brightnessMonitor?.setBrightness(value)
}
@@ -54,6 +55,7 @@ ColumnLayout {
WSlider {
Layout.fillWidth: true
value: Audio.sink.audio.volume
scrollable: true
onMoved: {
Audio.sink.audio.volume = value;
}
@@ -11,6 +11,8 @@ Slider {
property real trackWidth: 4
property string tooltipContent: `${Math.round(value * 100)}`
property bool scrollable: false
stepSize: 0.02
leftPadding: 0
rightPadding: 0
@@ -22,10 +24,24 @@ Slider {
}
}
background: Item {
background: MouseArea {
id: background
anchors.fill: parent
onWheel: (event) => {
if (!root.scrollable) {
event.accepted = false;
return;
}
if (event.angleDelta.y > 0) {
root.value = Math.min(root.value + root.stepSize, 1)
root.moved()
} else {
root.value = Math.max(root.value - root.stepSize, 0)
root.moved()
}
}
Rectangle {
id: trackHighlight
anchors {