make mousearea root of clickable
This commit is contained in:
parent
8ac31838d5
commit
bf55feceb4
2 changed files with 15 additions and 27 deletions
|
|
@ -27,8 +27,14 @@ Loader {
|
|||
modelData.play();
|
||||
}
|
||||
}
|
||||
onScrolledUp: parent.nextPlayer()
|
||||
onScrolledDown: parent.previousPlayer()
|
||||
|
||||
onWheel: event => {
|
||||
if (event.angleDelta.y > 0) {
|
||||
parent.nextPlayer();
|
||||
} else if (event.angleDelta.y < 0) {
|
||||
parent.previousPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: text
|
||||
|
|
@ -44,7 +50,7 @@ Loader {
|
|||
|
||||
states: State {
|
||||
name: "hovered"
|
||||
when: clickable.hovered
|
||||
when: clickable.containsMouse
|
||||
PropertyChanges {
|
||||
text {
|
||||
color: Theme.palette.base300
|
||||
|
|
|
|||
|
|
@ -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
Reference in a new issue