make mousearea root of clickable
This commit is contained in:
parent
8ac31838d5
commit
bf55feceb4
2 changed files with 15 additions and 27 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue