mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-31 00:34:45 +00:00
quicksettings: Fix brightness slider
Status: - Tested on my OP6 with PostmarketOS edge. (Pmbootstrap build + sideload) Fix issue https://invent.kde.org/teams/plasma-mobile/issues/-/issues/306
This commit is contained in:
parent
eef3a2822a
commit
a6a16507c3
2 changed files with 29 additions and 15 deletions
|
|
@ -12,16 +12,16 @@ import org.kde.kirigami 2.20 as Kirigami
|
||||||
|
|
||||||
import org.kde.plasma.core as PlasmaCore
|
import org.kde.plasma.core as PlasmaCore
|
||||||
import org.kde.plasma.components 3.0 as PC3
|
import org.kde.plasma.components 3.0 as PC3
|
||||||
import org.kde.plasma.private.brightnesscontrolplugin as BC
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
implicitHeight: brightnessRow.implicitHeight
|
implicitHeight: brightnessRow.implicitHeight
|
||||||
|
|
||||||
BC.ScreenBrightnessControl {
|
property alias value: brightnessSlider.value
|
||||||
id: screenBrightnessControl
|
property alias maximumValue: brightnessSlider.to
|
||||||
}
|
|
||||||
|
signal moved()
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: brightnessRow
|
id: brightnessRow
|
||||||
|
|
@ -44,12 +44,8 @@ Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
from: 1
|
from: 1
|
||||||
to: screenBrightnessControl.brightnessMax
|
|
||||||
value: screenBrightnessControl.brightness
|
|
||||||
|
|
||||||
onMoved: {
|
onMoved: root.moved()
|
||||||
screenBrightnessControl.brightness = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.Icon {
|
Kirigami.Icon {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import org.kde.plasma.private.mobileshell as MobileShell
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||||
import org.kde.kirigami 2.20 as Kirigami
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
|
import org.kde.plasma.private.brightnesscontrolplugin as BC
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quick settings elements layout, change the height to clip.
|
* Quick settings elements layout, change the height to clip.
|
||||||
|
|
@ -106,12 +107,29 @@ Item {
|
||||||
sourceComponent: root.mode === QuickSettings.Pages ? swipeViewComponent : scrollViewComponent
|
sourceComponent: root.mode === QuickSettings.Pages ? swipeViewComponent : scrollViewComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
BrightnessItem {
|
BC.ScreenBrightnessControl {
|
||||||
id: brightnessItem
|
id: screenBrightnessControl
|
||||||
Layout.bottomMargin: Kirigami.Units.smallSpacing * 2
|
}
|
||||||
Layout.leftMargin: Kirigami.Units.smallSpacing
|
|
||||||
Layout.rightMargin: Kirigami.Units.smallSpacing
|
Repeater {
|
||||||
Layout.fillWidth: true
|
id: brightnessRepeater
|
||||||
|
model: screenBrightnessControl.displays
|
||||||
|
|
||||||
|
BrightnessItem {
|
||||||
|
required property string displayName
|
||||||
|
required property int brightness
|
||||||
|
required property int maxBrightness
|
||||||
|
|
||||||
|
Layout.bottomMargin: Kirigami.Units.smallSpacing * 2
|
||||||
|
Layout.leftMargin: Kirigami.Units.smallSpacing
|
||||||
|
Layout.rightMargin: Kirigami.Units.smallSpacing
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
value: brightness
|
||||||
|
maximumValue: maxBrightness
|
||||||
|
|
||||||
|
onMoved: screenBrightnessControl.setBrightness(displayName, value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue