1
mirror of https://github.com/monero-project/monero-gui synced 2025-01-02 21:26:24 +01:00

Hover effects for titlebar buttons

This commit is contained in:
Sander Ferdinand 2017-12-24 21:52:29 +01:00 committed by moneromooo-monero
parent 129562594d
commit 4f3bf839f7
5 changed files with 27 additions and 9 deletions

View File

@ -32,6 +32,7 @@ import "." 1.0
Item { Item {
id: button id: button
property string rightIcon: ""
property string icon: "" property string icon: ""
property string textColor: button.enabled? Style.buttonTextColor: Style.buttonTextColorDisabled property string textColor: button.enabled? Style.buttonTextColor: Style.buttonTextColorDisabled
property bool small: false property bool small: false
@ -58,7 +59,6 @@ Item {
anchors.right: parent.right anchors.right: parent.right
height: parent.height - 1 height: parent.height - 1
radius: 3 radius: 3
// color: parent.enabled ? Style.buttonBackgroundColor : Style.buttonBackgroundColorDisabled
color: parent.enabled ? Style.buttonBackgroundColor : Style.buttonBackgroundColorDisabled color: parent.enabled ? Style.buttonBackgroundColor : Style.buttonBackgroundColorDisabled
border.width: parent.focus ? 1 : 0 border.width: parent.focus ? 1 : 0

View File

@ -84,7 +84,7 @@ Rectangle {
property bool checked: false property bool checked: false
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
color: "black" color: "transparent"
height: 50 * scaleRatio height: 50 * scaleRatio
width: height width: height
visible: isMobile visible: isMobile
@ -101,6 +101,9 @@ Rectangle {
id: basicMouseArea id: basicMouseArea
hoverEnabled: true hoverEnabled: true
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onEntered: goToBasicVersionButton.color = "#262626";
onExited: goToBasicVersionButton.color = "transparent";
onClicked: { onClicked: {
releaseFocus() releaseFocus()
parent.checked = !parent.checked parent.checked = !parent.checked
@ -118,7 +121,7 @@ Rectangle {
z: 2 z: 2
Rectangle { Rectangle {
property bool containsMouse: titleBar.mouseX >= x + row.x && titleBar.mouseX <= x + row.x + width && titleBar.containsMouse id: whatIsAreaButton
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: 42 width: 42
@ -134,6 +137,9 @@ Rectangle {
MouseArea { MouseArea {
id: whatIsArea id: whatIsArea
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onEntered: whatIsAreaButton.color = "#262626";
onExited: whatIsAreaButton.color = "transparent";
onClicked: { onClicked: {
} }
@ -141,11 +147,11 @@ Rectangle {
} }
Rectangle { Rectangle {
property bool containsMouse: titleBar.mouseX >= x + row.x && titleBar.mouseX <= x + row.x + width && titleBar.containsMouse id: minimizeButton
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: 42 width: 42
color: containsMouse ? "#3665B3" : "#00000000" color: "transparent"
Image { Image {
anchors.centerIn: parent anchors.centerIn: parent
@ -155,6 +161,10 @@ Rectangle {
MouseArea { MouseArea {
id: minimizeArea id: minimizeArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: minimizeButton.color = "#262626";
onExited: minimizeButton.color = "transparent";
onClicked: { onClicked: {
appWindow.visibility = Window.Minimized appWindow.visibility = Window.Minimized
} }
@ -163,11 +173,10 @@ Rectangle {
Rectangle { Rectangle {
id: maximizeButton id: maximizeButton
property bool containsMouse: titleBar.mouseX >= x + row.x && titleBar.mouseX <= x + row.x + width && titleBar.containsMouse
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: 42 width: 42
color: containsMouse ? "#FF6C3C" : "#00000000" color: "transparent";
Image { Image {
anchors.centerIn: parent anchors.centerIn: parent
@ -175,12 +184,15 @@ Rectangle {
width: 16 width: 16
source: appWindow.visibility === Window.FullScreen ? "../images/backToWindowIcon.png" : source: appWindow.visibility === Window.FullScreen ? "../images/backToWindowIcon.png" :
"../images/fullscreen.png" "../images/fullscreen.png"
} }
MouseArea { MouseArea {
id: maximizeArea id: maximizeArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: maximizeButton.color = "#262626";
onExited: maximizeButton.color = "transparent";
onClicked: { onClicked: {
appWindow.visibility = appWindow.visibility !== Window.FullScreen ? Window.FullScreen : appWindow.visibility = appWindow.visibility !== Window.FullScreen ? Window.FullScreen :
Window.Windowed Window.Windowed
@ -189,7 +201,7 @@ Rectangle {
} }
Rectangle { Rectangle {
property bool containsMouse: titleBar.mouseX >= x + row.x && titleBar.mouseX <= x + row.x + width && titleBar.containsMouse id: closeButton
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: 42 width: 42
@ -205,6 +217,10 @@ Rectangle {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: appWindow.close(); onClicked: appWindow.close();
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: closeButton.color = "#262626";
onExited: closeButton.color = "transparent";
} }
} }
} }

BIN
images/rightArrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

View File

@ -275,6 +275,7 @@ Rectangle {
RowLayout { RowLayout {
StandardButton { StandardButton {
id: sendButton id: sendButton
rightIcon: "../images/rightIcon.png"
Layout.bottomMargin: 17 * scaleRatio Layout.bottomMargin: 17 * scaleRatio
Layout.topMargin: 17 * scaleRatio Layout.topMargin: 17 * scaleRatio
text: qsTr("Send") + translationManager.emptyString text: qsTr("Send") + translationManager.emptyString

View File

@ -196,5 +196,6 @@
<file>components/LabelButton.qml</file> <file>components/LabelButton.qml</file>
<file>components/LabelSubheader.qml</file> <file>components/LabelSubheader.qml</file>
<file>images/arrow-right-medium-white.png</file> <file>images/arrow-right-medium-white.png</file>
<file>images/rightArrow.png</file>
</qresource> </qresource>
</RCC> </RCC>