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:
parent
b4389402e9
commit
05a8303d5b
|
@ -16,6 +16,7 @@ Menu {
|
||||||
|
|
||||||
delegate: MenuItem {
|
delegate: MenuItem {
|
||||||
property color textColor: this.action.icon.color.toString() !== "#00000000" ? this.action.icon.color : Style.current.textColor
|
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: {
|
property int subMenuIndex: {
|
||||||
if (!this.subMenu) {
|
if (!this.subMenu) {
|
||||||
return -1
|
return -1
|
||||||
|
@ -114,7 +115,12 @@ Menu {
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
implicitWidth: 220
|
implicitWidth: 220
|
||||||
implicitHeight: enabled ? 24 : 0
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue