zhengtianzuo系列-Qml进度条

weixin_38080439 2019-09-19 04:55:14
基本上是官网例子上加了一些方法```ProgressBar {    property color proColor: "#148014"    property color proBackgroundColor: "#AAAAAA"    property int proWidth: 2    property real progress: 0    property real proRadius: 3    property alias interval: timer.interval    function isRunning(){        return(timer.running)    }    function onStart(){        cProgress.progress = 0;        timer.running = true;    }    function onStop(){        timer.running = false;    }    id: cProgress    anchors.centerIn: parent    value: (progress/100)    padding: 2    background: Rectangle {        implicitWidth: 200        implicitHeight: 16        color: cProgress.proBackgroundColor        radius: cProgress.proRadius    }    contentItem: Item {        implicitWidth: 200        implicitHeight: 10        Rectangle {            width: cProgress.visualPosition * parent.width            height: parent.height            radius: 2            color: cProgress.proColor        }    }    Timer{        id: timer        running: false        repeat: true        interval: 50        onTriggered:{            cProgress.progress++;            if (cProgress.progress > 100){                cProgress.onStop();                return;            }        }    }}```需要完整代码请访问 QtQuickExamples
...全文
14 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

435

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧