I need to create a Progress bar as below using QML Controls 2 :
ProgressBar{
id:progressBar
width : parent.width * 0.80
height:parent.height * 0.05
anchors.bottom:parent.bottom
anchors.bottomMargin: (parent.height * 0.03)
anchors.left:parent.left
anchors.leftMargin: (parent.width * 0.05)
value : 0.5
background: Rectangle {
color: "#e6e6e6"
radius: 3
}
contentItem: Item {
Rectangle {
width: progressBar.visualPosition * parent.width
height: parent.height
radius: 2
color: "#17a81a"
gradient: Gradient {
GradientStop {
position: 0.0
SequentialAnimation on color {
loops: Animation.Infinite
ColorAnimation { from: "#14148c"; to: "#0E1533"; duration: 5000 }
ColorAnimation { from: "#0E1533"; to: "#14148c"; duration: 5000 }
}
}
GradientStop {
position: 1.0
SequentialAnimation on color {
loops: Animation.Infinite
ColorAnimation { from: "#14aaff"; to: "#437284"; duration: 5000 }
ColorAnimation { from: "#437284"; to: "#14aaff"; duration: 5000 }
}
}
}
}
}
}
I have never used animations in QML and I tried with sequential animation as above which animates top to bottom. But i need it to animate left to right.
Can anyone help me to achieve this?
Best Answer
As for me I guess its bad idea to overwrite system behavior of controls. Anyway, you can play with animated gradient. For example: