forked from Shinonome/dots-hyprland
action center: scrollable quick sliders (#2536)
This commit is contained in:
+2
@@ -33,6 +33,7 @@ ColumnLayout {
|
|||||||
WSlider {
|
WSlider {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
value: root.brightnessMonitor?.brightness ?? 0
|
value: root.brightnessMonitor?.brightness ?? 0
|
||||||
|
scrollable: true
|
||||||
onMoved: {
|
onMoved: {
|
||||||
root.brightnessMonitor?.setBrightness(value)
|
root.brightnessMonitor?.setBrightness(value)
|
||||||
}
|
}
|
||||||
@@ -54,6 +55,7 @@ ColumnLayout {
|
|||||||
WSlider {
|
WSlider {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
value: Audio.sink.audio.volume
|
value: Audio.sink.audio.volume
|
||||||
|
scrollable: true
|
||||||
onMoved: {
|
onMoved: {
|
||||||
Audio.sink.audio.volume = value;
|
Audio.sink.audio.volume = value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ Slider {
|
|||||||
|
|
||||||
property real trackWidth: 4
|
property real trackWidth: 4
|
||||||
property string tooltipContent: `${Math.round(value * 100)}`
|
property string tooltipContent: `${Math.round(value * 100)}`
|
||||||
|
property bool scrollable: false
|
||||||
|
stepSize: 0.02
|
||||||
leftPadding: 0
|
leftPadding: 0
|
||||||
rightPadding: 0
|
rightPadding: 0
|
||||||
|
|
||||||
@@ -22,10 +24,24 @@ Slider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Item {
|
background: MouseArea {
|
||||||
id: background
|
id: background
|
||||||
anchors.fill: parent
|
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 {
|
Rectangle {
|
||||||
id: trackHighlight
|
id: trackHighlight
|
||||||
anchors {
|
anchors {
|
||||||
|
|||||||
Reference in New Issue
Block a user