What I would like is that if the object is in a certain state it should call func1 when onClicked is called and in a different state should call a different function. So instead of something like this:
Rectangle {
anchors.fill: parent
anchors.margins: 20
MouseArea {
id: area
anchors.fill: parent
onClicked:{
if state == "one":
... do somethone for one...
else:
... do somethone for two...
}
}
}
I want something like this.
states [
State {
name = "one"
"somehow set area.onclicked to handleOne"
},
State {
name = "two"
"somehow set area.onclicked to handleTwo"
},
]
function handleOne() {
}
function handleTwo() {
}
Rectangle {
anchors.fill: parent
anchors.margins: 20
MouseArea {
id: area
anchors.fill: parent
}
}
↧