Fix the hover for the other menu items
authorKevin Ottens <kevin.ottens@nextcloud.com>
Mon, 6 Jul 2020 11:55:14 +0000 (13:55 +0200)
committerCamila <smayres@gmail.com>
Mon, 6 Jul 2020 18:14:57 +0000 (20:14 +0200)
Ultimately we would avoid the code duplication by creating our own
proper QQC2 style instead of directly tuning everything. That's a battle
for another time (more elements would need to be adjusted for that, I
don't want to dilute this branch too much).

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/gui/tray/UserLine.qml
src/gui/tray/Window.qml

index 706eccb49a98aeb9da50a44eb261c1c5bb460e4e..a2bedbec3120f7e23ecf88e26e5d3d61fc78a83f 100644 (file)
@@ -22,6 +22,7 @@ MenuItem {
                 Layout.preferredWidth: (userLineLayout.width * (5/6))\r
                 Layout.preferredHeight: (userLineLayout.height)\r
                 display: AbstractButton.IconOnly\r
+                hoverEnabled: true\r
                 flat: true\r
 \r
                 MouseArea {\r
@@ -39,8 +40,15 @@ MenuItem {
                     }\r
                 }\r
 \r
-                background: Rectangle {\r
-                    color: "transparent"\r
+\r
+                background: Item {\r
+                    height: parent.height\r
+                    width: parent.menu.width\r
+                    Rectangle {\r
+                        anchors.fill: parent\r
+                        anchors.margins: 1\r
+                        color: parent.parent.hovered ? Style.lightHover : "transparent"\r
+                    }\r
                 }\r
 \r
                 RowLayout {\r
@@ -140,19 +148,41 @@ MenuItem {
                     MenuItem {\r
                         text: isConnected ? qsTr("Log out") : qsTr("Log in")\r
                         font.pixelSize: Style.topLinePixelSize\r
+                        hoverEnabled: true\r
                         onClicked: {\r
                             isConnected ? UserModel.logout(index) : UserModel.login(index)\r
                             accountMenu.close()\r
                         }\r
+\r
+                        background: Item {\r
+                            height: parent.height\r
+                            width: parent.menu.width\r
+                            Rectangle {\r
+                                anchors.fill: parent\r
+                                anchors.margins: 1\r
+                                color: parent.parent.hovered ? Style.lightHover : "transparent"\r
+                            }\r
+                        }\r
                     }\r
 \r
                     MenuItem {\r
                         text: qsTr("Remove Account")\r
                         font.pixelSize: Style.topLinePixelSize\r
+                        hoverEnabled: true\r
                         onClicked: {\r
                             UserModel.removeAccount(index)\r
                             accountMenu.close()\r
                         }\r
+\r
+                        background: Item {\r
+                            height: parent.height\r
+                            width: parent.menu.width\r
+                            Rectangle {\r
+                                anchors.fill: parent\r
+                                anchors.margins: 1\r
+                                color: parent.parent.hovered ? Style.lightHover : "transparent"\r
+                            }\r
+                        }\r
                     }\r
                 }\r
             }\r
index 982a3f1f7217932c4f003203529dee755505180b..aa8063460cf6d8bff41e948d521d9ba0fecb3675 100644 (file)
@@ -170,6 +170,17 @@ Window {
                             MenuItem {\r
                                 id: addAccountButton\r
                                 height: Style.addAccountButtonHeight\r
+                                hoverEnabled: true\r
+\r
+                                background: Item {\r
+                                    height: parent.height\r
+                                    width: parent.menu.width\r
+                                    Rectangle {\r
+                                        anchors.fill: parent\r
+                                        anchors.margins: 1\r
+                                        color: parent.parent.hovered ? Style.lightHover : "transparent"\r
+                                    }\r
+                                }\r
 \r
                                 RowLayout {\r
                                     anchors.fill: parent\r
@@ -207,19 +218,52 @@ Window {
                             MenuItem {\r
                                 id: syncPauseButton\r
                                 font.pixelSize: Style.topLinePixelSize\r
+                                hoverEnabled: true\r
                                 onClicked: Systray.pauseResumeSync()\r
+\r
+                                background: Item {\r
+                                    height: parent.height\r
+                                    width: parent.menu.width\r
+                                    Rectangle {\r
+                                        anchors.fill: parent\r
+                                        anchors.margins: 1\r
+                                        color: parent.parent.hovered ? Style.lightHover : "transparent"\r
+                                    }\r
+                                }\r
                             }\r
 \r
                             MenuItem {\r
                                 text: qsTr("Settings")\r
                                 font.pixelSize: Style.topLinePixelSize\r
+                                hoverEnabled: true\r
                                 onClicked: Systray.openSettings()\r
+\r
+                                background: Item {\r
+                                    height: parent.height\r
+                                    width: parent.menu.width\r
+                                    Rectangle {\r
+                                        anchors.fill: parent\r
+                                        anchors.margins: 1\r
+                                        color: parent.parent.hovered ? Style.lightHover : "transparent"\r
+                                    }\r
+                                }\r
                             }\r
 \r
                             MenuItem {\r
                                 text: qsTr("Exit");\r
                                 font.pixelSize: Style.topLinePixelSize\r
+                                hoverEnabled: true\r
                                 onClicked: Systray.shutdown()\r
+\r
+                                background: Item {\r
+                                    height: parent.height\r
+                                    width: parent.menu.width\r
+                                    Rectangle {\r
+                                        anchors.fill: parent\r
+                                        anchors.margins: 1\r
+                                        color: parent.parent.hovered ? Style.lightHover : "transparent"\r
+                                    }\r
+                                }\r
                             }\r
                         }\r
                     }\r