fix: fix PopupMenu style

This commit is contained in:
Jonathan Rainville 2020-07-09 14:26:50 -04:00 committed by Iuri Matias
parent 9462beaa3f
commit dd6454f55c
3 changed files with 34 additions and 31 deletions

View File

@ -129,9 +129,9 @@ Rectangle {
onTriggered: chatsModel.clearChatHistory(chatsModel.activeChannel.id) onTriggered: chatsModel.clearChatHistory(chatsModel.activeChannel.id)
} }
Action { Action {
icon.source: "../../../img/leave_chat.svg" icon.source: "../../../img/delete.svg"
//% "Leave Chat" icon.color: Style.current.red
text: qsTrId("leave-chat") text: qsTr("Delete Chat")
onTriggered: chatsModel.leaveActiveChat() onTriggered: chatsModel.leaveActiveChat()
} }
} }

3
ui/app/img/delete.svg Normal file
View File

@ -0,0 +1,3 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.26191 0.5C4.47293 0.5 3.83333 1.13959 3.83333 1.92857C3.83333 2.33621 3.50288 2.66667 3.09524 2.66667H1C0.723858 2.66667 0.5 2.89052 0.5 3.16667C0.5 3.44281 0.723858 3.66667 1 3.66667H1.49251C1.66109 3.66667 1.80314 3.79253 1.82342 3.95989L2.71566 11.3209C2.87795 12.6597 4.0143 13.6667 5.36295 13.6667H8.63705C9.9857 13.6667 11.1221 12.6597 11.2843 11.3209L12.1766 3.95989C12.1969 3.79253 12.3389 3.66667 12.5075 3.66667H13C13.2761 3.66667 13.5 3.44281 13.5 3.16667C13.5 2.89052 13.2761 2.66667 13 2.66667H10.9048C10.4971 2.66667 10.1667 2.33621 10.1667 1.92857C10.1667 1.13959 9.52707 0.5 8.7381 0.5L5.26191 0.5ZM8.80586 2.66667C9.0501 2.66667 9.21559 2.40724 9.18265 2.16524C9.17211 2.08786 9.16667 2.00885 9.16667 1.92857C9.16667 1.69188 8.97479 1.5 8.7381 1.5L5.2619 1.5C5.02521 1.5 4.83333 1.69188 4.83333 1.92857C4.83333 2.00885 4.82789 2.08786 4.81736 2.16524C4.78441 2.40725 4.9499 2.66667 5.19414 2.66667L8.80586 2.66667ZM10.9048 3.66667C11.0643 3.66667 11.1879 3.80617 11.1687 3.96453L10.2916 11.2006C10.1902 12.0373 9.47996 12.6667 8.63705 12.6667H5.36295C4.52004 12.6667 3.80983 12.0373 3.7084 11.2006L2.8313 3.96453C2.81211 3.80616 2.93572 3.66667 3.09524 3.66667L10.9048 3.66667Z" fill="#FF2D55"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -6,48 +6,48 @@ import "../shared"
Menu { Menu {
property alias arrowX: bgPopupMenuTopArrow.x property alias arrowX: bgPopupMenuTopArrow.x
property int paddingSize: 8
closePolicy: Popup.CloseOnPressOutsideParent closePolicy: Popup.CloseOnPressOutsideParent
id: popupMenu id: popupMenu
topPadding: Style.current.padding topPadding: bgPopupMenuTopArrow.height + paddingSize
bottomPadding: Style.current.padding bottomPadding: paddingSize
delegate: MenuItem { delegate: MenuItem {
id: popupMenuItem id: popupMenuItem
implicitWidth: 200 implicitWidth: 200
implicitHeight: 40 implicitHeight: 34
font.pixelSize: 15 font.pixelSize: 13
icon.color: popupMenuItem.action.icon.color != "#00000000" ? popupMenuItem.action.icon.color : Style.current.blue icon.color: popupMenuItem.action.icon.color != "#00000000" ? popupMenuItem.action.icon.color : Style.current.blue
contentItem: Item { contentItem: Item {
id: menuItemContent id: menuItemContent
Item {
id: menuIcon
anchors.left: parent.left
anchors.leftMargin: 12
height: popupMenuItemIcon.height
anchors.verticalCenter: parent.verticalCenter
SVGImage {
id: popupMenuItemIcon
source: popupMenuItem.icon.source
visible: false
width: 25
height: 25
}
ColorOverlay { SVGImage {
cached: true id: menuIcon
anchors.fill: popupMenuItemIcon source: popupMenuItem.icon.source
anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left
source: popupMenuItemIcon anchors.leftMargin: Style.current.padding
color: popupMenuItem.highlighted ? Style.current.white : popupMenuItem.action.icon.color anchors.verticalCenter: parent.verticalCenter
} visible: false
width: 13
height: 13
}
ColorOverlay {
cached: true
anchors.fill: menuIcon
source: menuIcon
color: popupMenuItem.highlighted ? Style.current.white : popupMenuItem.action.icon.color
} }
StyledText { StyledText {
anchors.left: menuIcon.right anchors.left: menuIcon.right
anchors.leftMargin: 32 anchors.leftMargin: popupMenu.paddingSize
topPadding: 4
text: popupMenuItem.text text: popupMenuItem.text
anchors.verticalCenter: menuIcon.verticalCenter
font: popupMenuItem.font font: popupMenuItem.font
color: popupMenuItem.highlighted ? Style.current.white : Style.current.black color: popupMenuItem.highlighted ?
Style.current.white :
(popupMenuItem.action.icon.color != "#00000000" ? popupMenuItem.action.icon.color : Style.current.black)
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
@ -55,7 +55,7 @@ Menu {
background: Rectangle { background: Rectangle {
implicitWidth: 220 implicitWidth: 220
implicitHeight: 40 implicitHeight: 24
color: popupMenuItem.highlighted ? popupMenuItem.icon.color : "transparent" color: popupMenuItem.highlighted ? popupMenuItem.icon.color : "transparent"
} }
} }