import Qt 4.7 Rectangle { id: progressBar property int minimum: 0 property int maximum: 100 property int value: -1 property int value2: 50 function setMax(intiger) { maximum=intiger } function setMin(intiger) { minimum=intiger } function setValue(intiger) { value= intiger } function setValue2(intiger) { value2= intiger } width: 250; height: 23 clip: true BorderImage { source: "qrc:/progressBar/background.png" width: parent.width; height: parent.height border { left: 4; top: 4; right: 4; bottom: 4 } } Rectangle { id: highlight z: 1; property int widthDest: (progressBar.width * (value - minimum)) / (maximum - minimum) - 6 property int position: (progressBar.width * (value2 - minimum)) / (maximum - minimum) width: (value>-1) ? (highlight.widthDest) : (90) anchors.leftMargin: (value>-1) ? (0) : (highlight.position) Behavior on width { SmoothedAnimation { velocity: 1200 } } Behavior on anchors.leftMargin { SequentialAnimation{ loops: Animation.Infinite SmoothedAnimation { velocity: 450; to: progressBar.width - 96} SmoothedAnimation { velocity: 450; to: 6 } } } radius: 1 anchors.top: parent.top anchors.left: parent.left anchors.bottom: parent.bottom anchors.margins: 3 gradient: Gradient { GradientStop {color:"#0510a0"; position: 0.0 } GradientStop {color:"#6b98f7"; position: 1.0 } } } Text { z: 1; anchors.right: highlight.right anchors.rightMargin: (value>-1) ? 6 : 35; anchors.verticalCenter: parent.verticalCenter color: "white" font.bold: true text: (value>-1) ? (Math.floor((value - minimum) / (maximum - minimum) * 100) + '%') : ("???"); } }