make mousearea root of clickable

This commit is contained in:
Benjamin Palko 2025-07-23 10:14:25 -04:00
parent 8ac31838d5
commit bf55feceb4
2 changed files with 15 additions and 27 deletions

View file

@ -1,13 +1,13 @@
import QtQuick
import "../config/"
Item {
id: root
MouseArea {
id: mouseArea
property bool disabled: false
property alias hovered: mouseArea.containsMouse
signal clicked
signal scrolledUp
signal scrolledDown
hoverEnabled: !disabled
cursorShape: Qt.PointingHandCursor
StyledLabel {
id: background
@ -32,22 +32,4 @@ Item {
}
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: !disabled
cursorShape: Qt.PointingHandCursor
onClicked: root.clicked()
onWheel: event => {
if (event.angleDelta.y > 0) {
root.scrolledUp();
} else if (event.angleDelta.y < 0) {
root.scrolledDown();
}
}
}
}