I am trying to show incremental changes on a progress bar by clicking a mouse area. The code below compiles and changes the value of the progress bar from 0 to 0.25 after clicking the mouse area. But the change is not permanent. I am trying to increase the current each click by 0.25. I know my code is only setting the value to positive .25 each click. I am just at a loss for how I might increment change in progress bar without global vars. I included the transition to ensure the state change was irreversible, the code still compiles and runs the same. There are two issues.
- My change is not permanent in the visible progress bar
- My increments do not increase the total value, they are singular value assignments
ProgressBar{
id: progressBar
height: 20
anchors.top: parent.top
anchors.topMargin: 100
anchors.horizontalCenter: parent.horizontalCenter
opacity: 1
value: 0
states: State{
name: "PressedAlso"
when: mouseArea.pressed == true
PropertyChanges{
target: progressBar
value: + 0.25
}
}
transitions: Transition {
from: ""; to: "PressedAlso"; reversible: false
}
}