nosignal-shell/components/controls/IconButton.qml
28allday 83d5de1ba3 feat(nosignal): Nerd Font icons in IconButton (controls-wide)
Convert the shared IconButton control to render via NsIcon, so every icon-button
across the shell (nexus, lock, utilities, launcher chrome, ...) uses Nerd Font.
Alias icon -> label.icon; internal MaterialIcon -> NsIcon (sizes from root.font
via fontStyle); dropped the Material-Symbols vertical-center fudge.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 11:19:16 +01:00

51 lines
1.6 KiB
QML

import QtQuick
import Caelestia.Config
import qs.components
import qs.services
ButtonBase {
id: root
property alias icon: label.icon
readonly property alias label: label
font: Tokens.font.icon.medium
padding: type === IconButton.Text ? Tokens.padding.extraSmall / 2 : Tokens.padding.small
activeColour: type === IconButton.Filled ? Colours.palette.m3primary : Colours.palette.m3secondary
inactiveColour: {
if (!isToggle && type === IconButton.Filled)
return Colours.palette.m3primary;
return type === IconButton.Filled ? Colours.tPalette.m3surfaceContainer : Colours.palette.m3secondaryContainer;
}
activeOnColour: type === IconButton.Filled ? Colours.palette.m3onPrimary : type === IconButton.Tonal ? Colours.palette.m3onSecondary : Colours.palette.m3primary
inactiveOnColour: {
if (!isToggle && type === IconButton.Filled)
return Colours.palette.m3onPrimary;
return type === IconButton.Tonal ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurfaceVariant;
}
implicitWidth: implicitHeight
implicitHeight: {
// Ensure even size so icon is centered properly
const h = label.implicitHeight + padding * 2;
if (h % 2 !== 0)
return h + 1;
return h;
}
NsIcon {
id: label
anchors.centerIn: parent
color: root.onColour
fontStyle: root.font
fill: !root.isToggle || root.internalChecked ? 1 : 0
Behavior on fill {
Anim {
type: Anim.DefaultEffects
}
}
}
}