From: Kevin Ottens Date: Mon, 6 Jul 2020 11:55:14 +0000 (+0200) Subject: Fix the hover for the other menu items X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~112 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d3d713ff9c2d884128c5a1e57341d4bf3ab05763;p=nextcloud-desktop.git Fix the hover for the other menu items 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 --- diff --git a/src/gui/tray/UserLine.qml b/src/gui/tray/UserLine.qml index 706eccb49..a2bedbec3 100644 --- a/src/gui/tray/UserLine.qml +++ b/src/gui/tray/UserLine.qml @@ -22,6 +22,7 @@ MenuItem { Layout.preferredWidth: (userLineLayout.width * (5/6)) Layout.preferredHeight: (userLineLayout.height) display: AbstractButton.IconOnly + hoverEnabled: true flat: true MouseArea { @@ -39,8 +40,15 @@ MenuItem { } } - background: Rectangle { - color: "transparent" + + background: Item { + height: parent.height + width: parent.menu.width + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: parent.parent.hovered ? Style.lightHover : "transparent" + } } RowLayout { @@ -140,19 +148,41 @@ MenuItem { MenuItem { text: isConnected ? qsTr("Log out") : qsTr("Log in") font.pixelSize: Style.topLinePixelSize + hoverEnabled: true onClicked: { isConnected ? UserModel.logout(index) : UserModel.login(index) accountMenu.close() } + + background: Item { + height: parent.height + width: parent.menu.width + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: parent.parent.hovered ? Style.lightHover : "transparent" + } + } } MenuItem { text: qsTr("Remove Account") font.pixelSize: Style.topLinePixelSize + hoverEnabled: true onClicked: { UserModel.removeAccount(index) accountMenu.close() } + + background: Item { + height: parent.height + width: parent.menu.width + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: parent.parent.hovered ? Style.lightHover : "transparent" + } + } } } } diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index 982a3f1f7..aa8063460 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -170,6 +170,17 @@ Window { MenuItem { id: addAccountButton height: Style.addAccountButtonHeight + hoverEnabled: true + + background: Item { + height: parent.height + width: parent.menu.width + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: parent.parent.hovered ? Style.lightHover : "transparent" + } + } RowLayout { anchors.fill: parent @@ -207,19 +218,52 @@ Window { MenuItem { id: syncPauseButton font.pixelSize: Style.topLinePixelSize + hoverEnabled: true onClicked: Systray.pauseResumeSync() + + background: Item { + height: parent.height + width: parent.menu.width + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: parent.parent.hovered ? Style.lightHover : "transparent" + } + } } MenuItem { text: qsTr("Settings") font.pixelSize: Style.topLinePixelSize + hoverEnabled: true onClicked: Systray.openSettings() + + background: Item { + height: parent.height + width: parent.menu.width + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: parent.parent.hovered ? Style.lightHover : "transparent" + } + } } MenuItem { text: qsTr("Exit"); font.pixelSize: Style.topLinePixelSize + hoverEnabled: true onClicked: Systray.shutdown() + + background: Item { + height: parent.height + width: parent.menu.width + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: parent.parent.hovered ? Style.lightHover : "transparent" + } + } } } }