From da026ab226f363b0dbf8c261ccc8b4f02439ec49 Mon Sep 17 00:00:00 2001 From: Andreas Traczyk Date: Fri, 9 Oct 2020 17:59:07 -0400 Subject: [PATCH] context menu: fix colored items on menu regen Change-Id: I59e68da48195292cbaa50021f0d677010ffb5a52 --- src/commoncomponents/GeneralMenuItem.qml | 43 +++++++++++++----------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/commoncomponents/GeneralMenuItem.qml b/src/commoncomponents/GeneralMenuItem.qml index e1192f34f..c83a69786 100644 --- a/src/commoncomponents/GeneralMenuItem.qml +++ b/src/commoncomponents/GeneralMenuItem.qml @@ -39,9 +39,17 @@ MenuItem { signal clicked - contentItem: Rectangle { + contentItem: AbstractButton { id: menuItemContentRect + background: Rectangle { + id: background + anchors.fill: parent + anchors.leftMargin: 1 + anchors.rightMargin: 1 + color: "transparent" + } + anchors.fill: parent ResponsiveImage { id: contextMenuItemImage @@ -75,7 +83,18 @@ MenuItem { verticalAlignment: Text.AlignVCenter } - color: "transparent" + onReleased: menuItem.clicked() + + states: [ + State { + name: "hovered"; when: hovered + PropertyChanges { target: background; color: JamiTheme.hoverColor } + }, + State { + name: "normal"; when: !hovered + PropertyChanges { target: background; color: "white" } + } + ] } onIconSourceChanged: { @@ -85,6 +104,8 @@ MenuItem { } } + highlighted: true + background: Rectangle { id: contextMenuBackgroundRect @@ -98,24 +119,6 @@ MenuItem { border.width: 0 color: menuItem.down ? JamiTheme.normalButtonColor : "white" - MouseArea { - anchors.fill: parent - hoverEnabled: true - onPressed: { - contextMenuBackgroundRect.color = JamiTheme.pressColor - } - onReleased: { - contextMenuBackgroundRect.color = JamiTheme.normalButtonColor - menuItem.clicked() - } - onEntered: { - contextMenuBackgroundRect.color = JamiTheme.hoverColor - } - onExited: { - contextMenuBackgroundRect.color = "white" - } - } - CustomBorder { commonBorder: false lBorderwidth: leftBorderWidth