qml 音乐播放器的进度条 |
您所在的位置:网站首页 › 假的音乐播放进度条复制 › qml 音乐播放器的进度条 |
进度条采用qml的Slider组件 样式什么的,网上很多。我就不列举了。接下来主要说明,进度条是怎样按秒移动的。 Slider { id: control value: 0 stepSize: 0.01 onValueChanged: { txt_time_start.text =formation(control.value) txt_time_end.text = formation(maximumValue); }}//timer启动 Timer{ id:time running: false repeat: true // interval: 500 onTriggered:{ control.value = control.value + control.stepSize } }//取得小数点后两位 function splitAndRound(num) { num = num * Math.pow(10, 2); return (Math.round(num)) / (Math.pow(10, 0)); }//歌曲的格式都是00:00 为了保持格式因为补0function formation(controlvalue) { //补0 function pad(num, n) { var len = num.toString().length; while(len < n) { num = "0" + num; len++; } return num; } var min = Math.floor(splitAndR |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |