styled list view
This commit is contained in:
parent
bac125abb0
commit
49ec4d8502
5 changed files with 94 additions and 82 deletions
|
|
@ -10,7 +10,7 @@ import Quickshell.Widgets
|
|||
|
||||
StyledLabel {
|
||||
id: root
|
||||
required property BluetoothDevice device
|
||||
required property BluetoothDevice modelData
|
||||
|
||||
RowLayout {
|
||||
id: row
|
||||
|
|
@ -18,21 +18,21 @@ StyledLabel {
|
|||
spacing: 8
|
||||
|
||||
Loader {
|
||||
active: root.device?.icon != undefined
|
||||
active: root.modelData?.icon != undefined
|
||||
sourceComponent: IconImage {
|
||||
implicitSize: 22
|
||||
source: Quickshell.iconPath(root.device.icon, "device-support-unknown-symbolic")
|
||||
source: Quickshell.iconPath(root.modelData.icon, "device-support-unknown-symbolic")
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: root.device.deviceName
|
||||
text: root.modelData.deviceName
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
StyledButton {
|
||||
hoverEnabled: root.device.state == BluetoothDeviceState.Disconnected
|
||||
hoverEnabled: root.modelData.state == BluetoothDeviceState.Disconnected
|
||||
color: containsMouse ? Theme.palette.primary : Theme.palette.base200
|
||||
content: StyledText {
|
||||
text: 'Connect'
|
||||
|
|
@ -42,12 +42,12 @@ StyledLabel {
|
|||
if (!hoverEnabled) {
|
||||
return;
|
||||
}
|
||||
root.device.connect();
|
||||
root.modelData.connect();
|
||||
}
|
||||
}
|
||||
|
||||
StyledButton {
|
||||
hoverEnabled: root.device.state == BluetoothDeviceState.Disconnected
|
||||
hoverEnabled: root.modelData.state == BluetoothDeviceState.Disconnected
|
||||
color: containsMouse ? Theme.palette.error : Theme.palette.base200
|
||||
content: StyledText {
|
||||
text: 'Unpair'
|
||||
|
|
@ -57,7 +57,7 @@ StyledLabel {
|
|||
if (!hoverEnabled) {
|
||||
return;
|
||||
}
|
||||
root.device.forget();
|
||||
root.modelData.forget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue