mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
IconButton: fix mousearea and animation
Co-authored-by: mmbyday <mmbyday@protonmail.com>
This commit is contained in:
parent
9689fff957
commit
eec1560ead
1 changed files with 12 additions and 6 deletions
|
@ -35,7 +35,6 @@ Item {
|
||||||
|
|
||||||
signal clicked(var mouse)
|
signal clicked(var mouse)
|
||||||
|
|
||||||
|
|
||||||
id: button
|
id: button
|
||||||
width: parent.height
|
width: parent.height
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
@ -53,7 +52,7 @@ Item {
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: buttonArea
|
id: buttonArea
|
||||||
anchors.fill: parent
|
anchors.fill: buttonImage
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
|
@ -61,14 +60,21 @@ Item {
|
||||||
buttonImage.x = buttonImage.x + 2
|
buttonImage.x = buttonImage.x + 2
|
||||||
buttonImage.y = buttonImage.y + 2
|
buttonImage.y = buttonImage.y + 2
|
||||||
}
|
}
|
||||||
|
|
||||||
onReleased: {
|
onReleased: {
|
||||||
buttonImage.x = buttonImage.x - 2
|
buttonImage.x = (parent.width - width) / 2
|
||||||
buttonImage.y = buttonImage.y - 2
|
buttonImage.y = (parent.height - height) / 2
|
||||||
|
}
|
||||||
|
|
||||||
|
onExited: {
|
||||||
|
if (pressed) {
|
||||||
|
buttonImage.x = (parent.width - width) / 2
|
||||||
|
buttonImage.y = (parent.height - height) / 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
parent.clicked(mouse)
|
parent.clicked(mouse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue