MouseArea from one state still active in other states
-
I defined various states in my program such as
@ IntroStep {
id: introstep
height: window.height - topmenu.height
width: window.width
anchors.top: topmenu.bottom
opacity: 1
}PreparationStep { id: prepastep height: window.height - topmenu.height width: window.width anchors.top: topmenu.bottom opacity: 0 } LoadStep { id: loadstep height: window.height - topmenu.height width: window.width anchors.top: topmenu.bottom opacity: 0 }
@
where the first view is shown and the other ones hidden. In this IntroStep element, I have a mouse area somewhere. Later in my program I hide this first state and display another one
@ states: [
State {
name: "intro"
PropertyChanges {
target: introstep
opacity: 1
}
PropertyChanges {
target: prepastep
opacity: 0
}
PropertyChanges {
target: topmenu
opacity: 1
}
},
State {
name: "prepa"
PropertyChanges {
target: introstep
opacity: 0
}
PropertyChanges {
target: prepastep
opacity: 1
}
PropertyChanges {
target: topmenu
opacity: 1
}
},
…
@but I found that the mouse area defined in the first view is still active in the second one. How can I disable this one ?
I know I can use the enabled: false flag, but how can I access it from outside the PreparationStep element ?
I have the feeling I'm missing something obvious here but I need help to figure out which one !
Thanks
Bidochon
-
Ok, well Bidochon, next time just post your question sooner and you won't have to struggle with it for hours. The solution, like you said in your post was to use enabled: false and all you had to do is add this statement in the State like this
@
State {
name: "loadstep"
PropertyChanges {
target: introstep
opacity: 0
}
PropertyChanges {
target: prepastep
opacity: 0
}
PropertyChanges {
target: loadstep
opacity: 1
}
PropertyChanges {
target: topmenu
opacity: 1
}
PropertyChanges {
target: prepastep
enabled: false
}
@ps: Somehow, I always have to ask the question here to figure out the answer myself 10 seconds later…. is that a sign that I need friends ? :-)
Bidochon
ps: hope that will help someone else out there.