osd: loader content
This commit is contained in:
parent
2fa949139a
commit
d06d8b870f
3 changed files with 19 additions and 9 deletions
|
|
@ -10,6 +10,7 @@ Slider {
|
|||
|
||||
required property string icon
|
||||
property real oldValue
|
||||
property bool initialized
|
||||
|
||||
orientation: Qt.Vertical
|
||||
|
||||
|
|
@ -32,7 +33,7 @@ Slider {
|
|||
handle: Item {
|
||||
id: handle
|
||||
|
||||
property bool moving
|
||||
property alias moving: icon.moving
|
||||
|
||||
y: root.visualPosition * (root.availableHeight - height)
|
||||
implicitWidth: root.width
|
||||
|
|
@ -64,7 +65,7 @@ Slider {
|
|||
MaterialIcon {
|
||||
id: icon
|
||||
|
||||
property bool moving: handle.moving
|
||||
property bool moving
|
||||
|
||||
function update(): void {
|
||||
animate = !moving;
|
||||
|
|
@ -73,7 +74,6 @@ Slider {
|
|||
font.family = moving ? Appearance.font.family.sans : Appearance.font.family.material;
|
||||
}
|
||||
|
||||
animate: true
|
||||
text: root.icon
|
||||
color: Colours.palette.m3inverseOnSurface
|
||||
anchors.centerIn: parent
|
||||
|
|
@ -108,6 +108,10 @@ Slider {
|
|||
onPressedChanged: handle.moving = pressed
|
||||
|
||||
onValueChanged: {
|
||||
if (!initialized) {
|
||||
initialized = true;
|
||||
return;
|
||||
}
|
||||
if (Math.abs(value - oldValue) < 0.01)
|
||||
return;
|
||||
oldValue = value;
|
||||
|
|
|
|||
|
|
@ -14,9 +14,6 @@ Item {
|
|||
required property Brightness.Monitor monitor
|
||||
required property var visibilities
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
|
||||
implicitWidth: layout.implicitWidth + Appearance.padding.large * 2
|
||||
implicitHeight: layout.implicitHeight + Appearance.padding.large * 2
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import qs.components
|
||||
import qs.services
|
||||
import qs.config
|
||||
|
|
@ -46,10 +48,17 @@ Item {
|
|||
}
|
||||
]
|
||||
|
||||
Content {
|
||||
Loader {
|
||||
id: content
|
||||
|
||||
monitor: Brightness.getMonitorForScreen(root.screen)
|
||||
visibilities: root.visibilities
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
|
||||
Component.onCompleted: active = Qt.binding(() => (root.visibilities.osd && Config.osd.enabled) || root.visible)
|
||||
|
||||
sourceComponent: Content {
|
||||
monitor: Brightness.getMonitorForScreen(root.screen)
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue