osd: make brightness icon go speen speen

This commit is contained in:
end-4
2025-05-16 08:26:23 +02:00
parent e85af8750a
commit 6680e9adec
2 changed files with 30 additions and 4 deletions
@@ -104,6 +104,7 @@ Scope {
anchors.centerIn: parent anchors.centerIn: parent
value: brightnessMonitor.brightness value: brightnessMonitor.brightness
icon: "light_mode" icon: "light_mode"
rotateIcon: true
name: qsTr("Brightness") name: qsTr("Brightness")
} }
} }
@@ -13,6 +13,7 @@ Item {
required property real value required property real value
required property string icon required property string icon
required property string name required property string name
property bool rotateIcon: false
property real valueIndicatorVerticalPadding: 5 property real valueIndicatorVerticalPadding: 5
property real valueIndicatorLeftPadding: 10 property real valueIndicatorLeftPadding: 10
@@ -33,14 +34,38 @@ Item {
Layout.margins: 10 Layout.margins: 10
spacing: 10 spacing: 10
MaterialSymbol { // Icon Item {
implicitWidth: 30
implicitHeight: 30
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: valueIndicatorLeftPadding Layout.leftMargin: valueIndicatorLeftPadding
Layout.topMargin: valueIndicatorVerticalPadding Layout.topMargin: valueIndicatorVerticalPadding
Layout.bottomMargin: valueIndicatorVerticalPadding Layout.bottomMargin: valueIndicatorVerticalPadding
color: Appearance.colors.colOnLayer0 MaterialSymbol { // Icon
text: root.icon anchors.centerIn: parent
iconSize: 30 color: Appearance.colors.colOnLayer0
renderType: Text.QtRendering
text: root.icon
iconSize: 20 + 10 * (root.rotateIcon ? value : 1)
rotation: 180 * (root.rotateIcon ? value : 0)
Behavior on iconSize {
NumberAnimation {
duration: Appearance.animation.elementMoveEnter.duration
easing.type: Appearance.animation.elementMoveEnter.type
easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve
}
}
Behavior on rotation {
NumberAnimation {
duration: Appearance.animation.elementMoveEnter.duration
easing.type: Appearance.animation.elementMoveEnter.type
easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve
}
}
}
} }
ColumnLayout { // Stuff ColumnLayout { // Stuff
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter