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();
|
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 {
|
StyledText {
|
||||||
id: text
|
id: text
|
||||||
|
|
@ -44,7 +50,7 @@ Loader {
|
||||||
|
|
||||||
states: State {
|
states: State {
|
||||||
name: "hovered"
|
name: "hovered"
|
||||||
when: clickable.hovered
|
when: clickable.containsMouse
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
text {
|
text {
|
||||||
color: Theme.palette.base300
|
color: Theme.palette.base300
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import "../config/"
|
import "../config/"
|
||||||
|
|
||||||
Item {
|
MouseArea {
|
||||||
id: root
|
id: mouseArea
|
||||||
|
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property alias hovered: mouseArea.containsMouse
|
|
||||||
signal clicked
|
hoverEnabled: !disabled
|
||||||
signal scrolledUp
|
cursorShape: Qt.PointingHandCursor
|
||||||
signal scrolledDown
|
|
||||||
|
|
||||||
StyledLabel {
|
StyledLabel {
|
||||||
id: background
|
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