NButton: fix issue when no icon defined

This commit is contained in:
LemmyCook 2025-09-09 09:22:05 -04:00
parent fe139c208a
commit a6ccc8b0da
3 changed files with 23 additions and 21 deletions

View file

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