NCheckbox+NToggle: better look

This commit is contained in:
LemmyCook 2025-09-14 12:03:15 -04:00
parent af0f4818d8
commit b163dab241
2 changed files with 13 additions and 12 deletions

View file

@ -13,7 +13,7 @@ RowLayout {
property bool hovering: false
property color activeColor: Color.mPrimary
property color activeOnColor: Color.mOnPrimary
property int baseSize: Math.max(Style.baseWidgetSize * 0.7, 14)
property int baseSize: Style.baseWidgetSize * 0.7
signal toggled(bool checked)
signal entered
@ -35,12 +35,12 @@ RowLayout {
Rectangle {
id: box
implicitWidth: root.baseSize * scaling
implicitHeight: root.baseSize * scaling
implicitWidth: Math.round(root.baseSize * scaling)
implicitHeight: Math.round(root.baseSize * scaling)
radius: Style.radiusXS * scaling
color: root.checked ? root.activeColor : Color.mSurface
border.color: Color.mOutline
border.width: Math.max(1, Style.borderM * scaling)
border.width: Math.max(1, Style.borderS * scaling)
Behavior on color {
ColorAnimation {
@ -60,7 +60,8 @@ RowLayout {
anchors.horizontalCenterOffset: -1 * scaling
icon: "check"
color: root.activeOnColor
font.pointSize: Math.max(Style.fontSizeXS, root.baseSize * 0.6) * scaling
font.pointSize: Math.max(Style.fontSizeXS, root.baseSize * 0.5) * scaling
font.weight: Style.fontWeightBold
}
MouseArea {