查看完整版本: [-- zhengtianzuo系列-Qml圆形进度条 --]

QTCN开发网 -> Qt代码秀 -> zhengtianzuo系列-Qml圆形进度条 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

zhengtianzuo 2017-10-28 10:07

zhengtianzuo系列-Qml圆形进度条

使用Qml的Canvas来画圆形

```
onPaint: {
        var ctx = getContext("2d")
        ctx.clearRect(0,0,width,height)
        ctx.beginPath()
        ctx.strokeStyle = arcBackgroundColor
        ctx.lineWidth = arcWidth
        ctx.arc(width/2,height/2,radius,0,Math.PI*2,anticlockwise)
        ctx.stroke()

        var r = progress*Math.PI/180
        ctx.beginPath()
        ctx.strokeStyle = arcColor
        ctx.lineWidth = arcWidth

        ctx.arc(width/2,height/2,radius,0-90*Math.PI/180,r-90*Math.PI/180,anticlockwise)
        ctx.stroke()
    }
```



需要完整代码请访问 QtQuickExamples

liuchangyin 2017-10-28 17:20


查看完整版本: [-- zhengtianzuo系列-Qml圆形进度条 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled