mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-06 02:15:23 +08:00
update
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
//进度条4
|
||||
Rectangle {
|
||||
id: control
|
||||
|
||||
@ -10,28 +9,42 @@ Rectangle {
|
||||
radius: 30
|
||||
border.width: linWidth
|
||||
color: "#00000000"
|
||||
border.color: Qt.rgba(214/255,214/255,214/255,1)
|
||||
border.color: FluApp.isDark ? Qt.rgba(41/255,41/255,41/255,1) : Qt.rgba(214/255,214/255,214/255,1)
|
||||
property real linWidth : 6
|
||||
property real progress: 0.25
|
||||
property bool indeterminate: true
|
||||
readonly property real radius2 : radius - linWidth/2
|
||||
property color primaryColor : Qt.rgba(0/255,102/255,180/255,1)
|
||||
property color primaryColor : FluApp.isDark ? Qt.rgba(76/255,160/255,224/255,1) : Qt.rgba(0/255,102/255,180/255,1)
|
||||
|
||||
onProgressChanged: {
|
||||
canvas.requestPaint()
|
||||
}
|
||||
|
||||
Connections{
|
||||
target: FluApp
|
||||
function onIsDarkChanged(isDark){
|
||||
canvas.requestPaint()
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if(indeterminate){
|
||||
behavior.enabled = true
|
||||
control.rotation = 360
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on rotation{
|
||||
id:anim
|
||||
enabled: true
|
||||
id:behavior
|
||||
enabled: false
|
||||
NumberAnimation{
|
||||
duration: 800
|
||||
duration: 1000
|
||||
onRunningChanged: {
|
||||
if(!running){
|
||||
anim.enabled = false
|
||||
behavior.enabled = false
|
||||
control.rotation = 0
|
||||
anim.enabled = true
|
||||
timer.start()
|
||||
behavior.enabled = true
|
||||
control.rotation = 360
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -54,30 +67,21 @@ Rectangle {
|
||||
ctx.arc(width/2, height/2, radius2 ,-0.5 * Math.PI,-0.5 * Math.PI + progress * 2 * Math.PI);
|
||||
ctx.stroke();
|
||||
ctx.closePath();
|
||||
// var start_x = width/2 + Math.cos(-0.5 * Math.PI) * radius2;
|
||||
// var start_y = height/2 + Math.sin(-0.5 * Math.PI) * radius2;
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(start_x, start_y, 3, 0, 2*Math.PI);
|
||||
// ctx.fill();
|
||||
// ctx.closePath();
|
||||
// var end_x = width/2 + Math.cos(-0.5 * Math.PI + progress * 2 * Math.PI) * radius2;
|
||||
// var end_y = height/2 + Math.sin(-0.5 * Math.PI + progress * 2 * Math.PI) * radius2;
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(end_x, end_y, 3, 0, 2*Math.PI);
|
||||
// ctx.fill();
|
||||
// ctx.closePath();
|
||||
// var start_x = width/2 + Math.cos(-0.5 * Math.PI) * radius2;
|
||||
// var start_y = height/2 + Math.sin(-0.5 * Math.PI) * radius2;
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(start_x, start_y, 3, 0, 2*Math.PI);
|
||||
// ctx.fill();
|
||||
// ctx.closePath();
|
||||
// var end_x = width/2 + Math.cos(-0.5 * Math.PI + progress * 2 * Math.PI) * radius2;
|
||||
// var end_y = height/2 + Math.sin(-0.5 * Math.PI + progress * 2 * Math.PI) * radius2;
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(end_x, end_y, 3, 0, 2*Math.PI);
|
||||
// ctx.fill();
|
||||
// ctx.closePath();
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
Timer{
|
||||
id:timer
|
||||
running: indeterminate
|
||||
interval: 800
|
||||
triggeredOnStart: true
|
||||
onTriggered: {
|
||||
control.rotation = 360
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user