qml的进度条

ProgressBar{
    id: control
    value: 0.1
    padding: 2
    background: Rectangle {
        implictWidth: 100
        implictHeight: 30
        color: "#e6e6e6"
        radius: 3
    }
 
    contentItem: Item{
         implictWidth: 100
         implictHeight: 30
         Rectangle {
            width: control.visualPosition * parent.width
            height: parent.height
            radius: 2
            color: "#17a81a"
        }
        
        Tetx {
            id: text1
            color: "blue"

            text: Math.floor(control.value * 100) + "%"
            z: 2
            anchors.centerIn: parent
        }
    }
    
    Timer {
        interval: 250
        repeat: true
        running: true
        onTriggered: {
            if (control.value < 0.99)
            {
                control.value += 0.01
            }
            else {
                text1.text = 100 + "%"
                stop();
            }
       }
  }

}

 

你可能感兴趣的:(qt)