Merge branch 'bootstrap-icons'

This commit is contained in:
LemmyCook 2025-09-09 11:44:27 -04:00
commit 56ea1f92fa
5 changed files with 27 additions and 21 deletions

View file

@ -38,6 +38,8 @@ NIconButton {
readonly property string middleClickExec: widgetSettings.middleClickExec || widgetMetadata.middleClickExec readonly property string middleClickExec: widgetSettings.middleClickExec || widgetMetadata.middleClickExec
readonly property bool hasExec: (leftClickExec || rightClickExec || middleClickExec) readonly property bool hasExec: (leftClickExec || rightClickExec || middleClickExec)
colorBorder: Color.transparent
colorBorderHover: Color.transparent
sizeRatio: 0.8 sizeRatio: 0.8
icon: customIcon icon: customIcon
tooltipText: { tooltipText: {

View file

@ -27,6 +27,7 @@ NBox {
RowLayout { RowLayout {
spacing: Style.marginS * scaling spacing: Style.marginS * scaling
NIcon { NIcon {
Layout.alignment: Qt.AlignVCenter
icon: weatherReady ? LocationService.weatherSymbolFromCode( icon: weatherReady ? LocationService.weatherSymbolFromCode(
LocationService.data.weather.current_weather.weathercode) : "" LocationService.data.weather.current_weather.weathercode) : ""
font.pointSize: Style.fontSizeXXXL * 1.75 * scaling font.pointSize: Style.fontSizeXXXL * 1.75 * scaling
@ -98,6 +99,7 @@ NBox {
color: Color.mOnSurface color: Color.mOnSurface
} }
NIcon { NIcon {
Layout.alignment: Qt.AlignVCenter
icon: LocationService.weatherSymbolFromCode(LocationService.data.weather.daily.weathercode[index]) icon: LocationService.weatherSymbolFromCode(LocationService.data.weather.daily.weathercode[index])
font.pointSize: Style.fontSizeXXL * scaling font.pointSize: Style.fontSizeXXL * scaling
color: Color.mPrimary color: Color.mPrimary

View file

@ -60,7 +60,7 @@ Singleton {
}, },
"CustomButton": { "CustomButton": {
"allowUserSettings": true, "allowUserSettings": true,
"icon": "favorite", "icon": "heart",
"leftClickExec": "", "leftClickExec": "",
"rightClickExec": "", "rightClickExec": "",
"middleClickExec": "" "middleClickExec": ""

View file

@ -80,29 +80,27 @@ Rectangle {
spacing: Style.marginXS * scaling spacing: Style.marginXS * scaling
// Icon (optional) // Icon (optional)
Loader { NIcon {
active: root.icon !== "" Layout.alignment: Qt.AlignVCenter
sourceComponent: NIcon { visible: root.icon !== ""
Layout.alignment: Qt.AlignVCenter
icon: root.icon icon: root.icon
font.pointSize: root.iconSize font.pointSize: root.iconSize
color: { color: {
if (!root.enabled) if (!root.enabled)
return Color.mOnSurfaceVariant return Color.mOnSurfaceVariant
if (root.outlined) { if (root.outlined) {
if (root.pressed || root.hovered) if (root.pressed || root.hovered)
return root.backgroundColor
return root.backgroundColor return root.backgroundColor
} return root.backgroundColor
return root.textColor
} }
return root.textColor
}
Behavior on color { Behavior on color {
ColorAnimation { ColorAnimation {
duration: Style.animationFast duration: Style.animationFast
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
}
} }
} }
} }

View file

@ -7,8 +7,12 @@ Text {
readonly property string defaultIcon: "balloon" readonly property string defaultIcon: "balloon"
property string icon: defaultIcon property string icon: defaultIcon
visible: (icon !== undefined) && (icon !== "")
text: { text: {
if (icon === undefined || Bootstrap.icons[icon] === undefined) { if ((icon === undefined) || (icon === "")) {
return ""
}
if (Bootstrap.icons[icon] === undefined) {
Logger.warn("Icon", `"${icon}"`, "doesn't exist in the bootstrap font") Logger.warn("Icon", `"${icon}"`, "doesn't exist in the bootstrap font")
Logger.callStack() Logger.callStack()
return Bootstrap.icons[defaultIcon] return Bootstrap.icons[defaultIcon]