feat: use button row for utils toggles
This commit is contained in:
parent
42446dbb0f
commit
f09b56d2ea
1 changed files with 9 additions and 16 deletions
|
|
@ -3,6 +3,7 @@ pragma ComponentBehavior: Bound
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell.Bluetooth
|
import Quickshell.Bluetooth
|
||||||
|
import Caelestia.Components
|
||||||
import Caelestia.Config
|
import Caelestia.Config
|
||||||
import qs.components
|
import qs.components
|
||||||
import qs.components.controls
|
import qs.components.controls
|
||||||
|
|
@ -56,23 +57,23 @@ StyledRect {
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickToggleRow {
|
QuickToggleRow {
|
||||||
rowModel: root.needExtraRow ? root.quickToggles.slice(0, root.splitIndex) : root.quickToggles
|
model: root.needExtraRow ? root.quickToggles.slice(0, root.splitIndex) : root.quickToggles
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickToggleRow {
|
QuickToggleRow {
|
||||||
visible: root.needExtraRow
|
visible: root.needExtraRow
|
||||||
rowModel: root.needExtraRow ? root.quickToggles.slice(root.splitIndex) : []
|
model: root.needExtraRow ? root.quickToggles.slice(root.splitIndex) : []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component QuickToggleRow: RowLayout {
|
component QuickToggleRow: ButtonRow {
|
||||||
property var rowModel: []
|
property alias model: repeater.model
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
spacing: Tokens.spacing.small
|
spacing: Tokens.spacing.small
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: parent.rowModel
|
id: repeater
|
||||||
|
|
||||||
delegate: DelegateChooser {
|
delegate: DelegateChooser {
|
||||||
role: "id"
|
role: "id"
|
||||||
|
|
@ -153,18 +154,10 @@ StyledRect {
|
||||||
}
|
}
|
||||||
|
|
||||||
component Toggle: IconButton {
|
component Toggle: IconButton {
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredWidth: implicitWidth + (stateLayer.pressed ? Tokens.padding.large : internalChecked ? Tokens.padding.small : 0)
|
|
||||||
radius: stateLayer.pressed ? Tokens.rounding.medium / 2 : internalChecked ? Tokens.rounding.medium : Tokens.rounding.large
|
|
||||||
inactiveColour: Colours.layer(Colours.palette.m3surfaceContainerHighest, 2)
|
inactiveColour: Colours.layer(Colours.palette.m3surfaceContainerHighest, 2)
|
||||||
|
fillWidth: true
|
||||||
isToggle: true
|
isToggle: true
|
||||||
radiusAnim.duration: Tokens.anim.durations.expressiveFastSpatial
|
isRound: true
|
||||||
radiusAnim.easing: Tokens.anim.expressiveFastSpatial
|
shapeMorph: true
|
||||||
|
|
||||||
Behavior on Layout.preferredWidth {
|
|
||||||
Anim {
|
|
||||||
type: Anim.FastSpatial
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue