fix(StatusUpdate): ensure hover effect is working properly

This commit introduces some `MouseArea`s so components inside the
`StatusUpdate` component cancel it out by having a higher `z`.

Also, in some cases we need to conditionally set the `root.hovered` property
to ensure the values get inverted correctly, otherwise it causes undesired
flicker effects.
This commit is contained in:
Pascal Precht 2020-12-17 11:03:53 +01:00 committed by Iuri Matias
parent 6a0a75888b
commit 8a1a265036
1 changed files with 21 additions and 6 deletions

View File

@ -52,6 +52,20 @@ Rectangle {
anchors.leftMargin: Style.current.halfPadding
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
mouse.accepted = false
}
onEntered: {
root.hovered = true
}
onExited: {
root.hovered = false
}
}
}
Loader {
@ -76,14 +90,15 @@ Rectangle {
anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true
onClicked: {
mouse.accepted = false
}
onEntered: {
root.hovered = true
if (!root.hovered) {
root.hovered = true
}
}
onExited: {
root.hovered = false
if (root.hovered) {
root.hovered = false
}
}
}
@ -112,7 +127,7 @@ Rectangle {
}
onExited: {
if (root.hovered) {
root.hovered = false
root.hovered = false
}
}
}