feat(PopupMenu): introduce `danger` type for actions

This is needed so that "dangerous" actions, such as deleting data
or removing users from groups etc, can get a dedicated hover color as well.
This commit is contained in:
Pascal Precht 2021-03-17 12:11:19 +01:00
parent b4389402e9
commit 05a8303d5b
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 7 additions and 1 deletions

View File

@ -16,6 +16,7 @@ Menu {
delegate: MenuItem {
property color textColor: this.action.icon.color.toString() !== "#00000000" ? this.action.icon.color : Style.current.textColor
property color hoverColor: this.action.type === "danger" ? Style.current.buttonWarnBackgroundColor : Style.current.backgroundHover
property int subMenuIndex: {
if (!this.subMenu) {
return -1
@ -114,7 +115,12 @@ Menu {
background: Rectangle {
implicitWidth: 220
implicitHeight: enabled ? 24 : 0
color: popupMenuItem.highlighted ? Style.current.backgroundHover : "transparent"
color: popupMenuItem.highlighted ? popupMenuItem.hoverColor : "transparent"
}
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onPressed: mouse.accepted = false
}
}