fix: category item style (#13975)

This commit is contained in:
Igor Sirotin 2024-03-14 15:46:28 +00:00 committed by GitHub
parent da4105784a
commit ad7f39f91c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -139,6 +139,7 @@ Item {
showAddButton: showCategoryActionButtons showAddButton: showCategoryActionButtons
showMenuButton: !!root.popupMenu showMenuButton: !!root.popupMenu
hasUnreadMessages: model.hasUnreadMessages hasUnreadMessages: model.hasUnreadMessages
muted: model.muted
onClicked: { onClicked: {
if (mouse.button === Qt.RightButton && showCategoryActionButtons && !!root.categoryPopupMenu) { if (mouse.button === Qt.RightButton && showCategoryActionButtons && !!root.categoryPopupMenu) {
statusChatListCategoryItem.setupPopup() statusChatListCategoryItem.setupPopup()

View File

@ -21,6 +21,7 @@ Control {
property bool showMenuButton: showActionButtons property bool showMenuButton: showActionButtons
property bool showAddButton: showActionButtons property bool showAddButton: showActionButtons
property bool hasUnreadMessages: false property bool hasUnreadMessages: false
property bool muted: false
property alias addButton: addButton property alias addButton: addButton
property alias menuButton: menuButton property alias menuButton: menuButton
property alias toggleButton: toggleButton property alias toggleButton: toggleButton
@ -44,10 +45,19 @@ Control {
StatusBaseText { StatusBaseText {
width: Math.min(implicitWidth, parent.width) width: Math.min(implicitWidth, parent.width)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
font.weight: Font.Medium font.weight: root.hasUnreadMessages ? Font.Bold : Font.Medium
font.pixelSize: 15 font.pixelSize: 15
elide: Text.ElideRight elide: Text.ElideRight
color: Theme.palette.directColor4 color: {
if (root.muted && !hoverHandler.hovered && !root.highlighted) {
return Theme.palette.directColor5
}
if (root.hasUnreadMessages || root.highlighted || hoverHandler.hovered) {
return Theme.palette.directColor1
}
return Theme.palette.directColor4
}
text: root.text text: root.text
} }
Row { Row {
@ -80,3 +90,4 @@ Control {
} }
} }
} }