Improve the sizing of notification count with longer numbers

This commit is contained in:
@@ -370,11 +370,13 @@ Kirigami.ScrollablePage {
|
|||||||
Accessible.name: i18n("Muted room")
|
Accessible.name: i18n("Muted room")
|
||||||
}
|
}
|
||||||
QQC2.Label {
|
QQC2.Label {
|
||||||
|
id: notificationCountLabel
|
||||||
text: notificationCount > 0 ? notificationCount : "●"
|
text: notificationCount > 0 ? notificationCount : "●"
|
||||||
visible: unreadCount > 0
|
visible: unreadCount > 0
|
||||||
color: Kirigami.Theme.textColor
|
color: Kirigami.Theme.textColor
|
||||||
Layout.rightMargin: Kirigami.Units.smallSpacing
|
Layout.rightMargin: Kirigami.Units.smallSpacing
|
||||||
Layout.minimumWidth: height
|
Layout.minimumHeight: Kirigami.Units.iconSizes.smallMedium
|
||||||
|
Layout.minimumWidth: Math.max(notificationCountTextMetrics.advanceWidth + Kirigami.Units.smallSpacing * 2, height)
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
visible: notificationCount > 0
|
visible: notificationCount > 0
|
||||||
@@ -383,6 +385,12 @@ Kirigami.ScrollablePage {
|
|||||||
opacity: highlightCount > 0 ? 1 : 0.3
|
opacity: highlightCount > 0 ? 1 : 0.3
|
||||||
radius: height / 2
|
radius: height / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: notificationCountTextMetrics
|
||||||
|
text: notificationCountLabel.text
|
||||||
|
onTextChanged: console.log(text, advanceWidth)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
QQC2.Button {
|
QQC2.Button {
|
||||||
id: configButton
|
id: configButton
|
||||||
|
|||||||
Reference in New Issue
Block a user