Notification: replace unread badge with small circle

This commit is contained in:
Ly-sec 2025-09-16 15:25:46 +02:00
parent 071100459f
commit 03bdfdb340

View file

@ -69,29 +69,20 @@ NIconButton {
Loader { Loader {
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.rightMargin: -4 * scaling anchors.rightMargin: 2 * scaling
anchors.topMargin: -4 * scaling anchors.topMargin: 1 * scaling
z: 2 z: 2
active: showUnreadBadge && (!hideWhenZero || computeUnreadCount() > 0) active: showUnreadBadge && (!hideWhenZero || computeUnreadCount() > 0)
sourceComponent: Rectangle { sourceComponent: Rectangle {
id: badge id: badge
readonly property int count: computeUnreadCount() readonly property int count: computeUnreadCount()
readonly property string label: count <= 99 ? String(count) : "99+" height: 8 * scaling
readonly property real pad: 8 * scaling width: height
height: 16 * scaling
width: Math.max(height, textNode.implicitWidth + pad)
radius: height / 2 radius: height / 2
color: Color.mError color: Color.mError
border.color: Color.mSurface border.color: Color.mSurface
border.width: 1 border.width: 1
visible: count > 0 || !hideWhenZero visible: count > 0 || !hideWhenZero
NText {
id: textNode
anchors.centerIn: parent
text: badge.label
font.pointSize: Style.fontSizeXXS * scaling
color: Color.mOnError
}
} }
} }
} }