SidePanelToggle: now allows to pick any icon from the font.

This commit is contained in:
LemmyCook
2025-09-19 16:37:38 -04:00
parent 9236b2f00e
commit 5cb9935f2f
5 changed files with 218 additions and 158 deletions
@@ -14,10 +14,12 @@ ColumnLayout {
property var widgetMetadata: null
// Local state
property string valueIcon: widgetData.icon !== undefined ? widgetData.icon : widgetMetadata.icon
property bool valueUseDistroLogo: widgetData.useDistroLogo !== undefined ? widgetData.useDistroLogo : widgetMetadata.useDistroLogo
function saveSettings() {
var settings = Object.assign({}, widgetData || {})
settings.icon = valueIcon
settings.useDistroLogo = valueUseDistroLogo
return settings
}
@@ -27,4 +29,34 @@ ColumnLayout {
checked: valueUseDistroLogo
onToggled: checked => valueUseDistroLogo = checked
}
RowLayout {
spacing: Style.marginM * scaling
NLabel {
label: "Icon"
description: "Select an icon from the library."
}
NIcon {
Layout.alignment: Qt.AlignVCenter
icon: valueIcon
font.pointSize: Style.fontSizeXL * scaling
visible: valueIcon !== ""
}
NButton {
enabled: !valueUseDistroLogo
text: "Browse"
onClicked: iconPicker.open()
}
}
NIconPicker {
id: iconPicker
initialIcon: valueIcon
onIconSelected: function (iconName) {
valueIcon = iconName
}
}
}