mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-03-15 00:19:42 +08:00
61 lines
1.8 KiB
QML
61 lines
1.8 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import FluentUI
|
|
|
|
ProgressBar{
|
|
property real strokeWidth: 6
|
|
property bool progressVisible: false
|
|
property color color: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
|
property color backgroundColor : FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1)
|
|
id:control
|
|
indeterminate : true
|
|
QtObject{
|
|
id:d
|
|
property real _radius: strokeWidth/2
|
|
}
|
|
background: Rectangle {
|
|
implicitWidth: 150
|
|
implicitHeight: control.strokeWidth
|
|
color: control.backgroundColor
|
|
radius: d._radius
|
|
}
|
|
contentItem: FluClip {
|
|
clip: true
|
|
radius: [d._radius,d._radius,d._radius,d._radius]
|
|
Rectangle {
|
|
id:rect_progress
|
|
width: {
|
|
if(control.indeterminate){
|
|
return 0.5 * parent.width
|
|
}
|
|
return control.visualPosition * parent.width
|
|
}
|
|
height: parent.height
|
|
radius: d._radius
|
|
color: control.color
|
|
PropertyAnimation on x {
|
|
running: control.indeterminate && control.visible
|
|
from: -rect_progress.width
|
|
to:control.width+rect_progress.width
|
|
loops: Animation.Infinite
|
|
duration: 888
|
|
}
|
|
}
|
|
}
|
|
FluText{
|
|
text:(control.visualPosition * 100).toFixed(0) + "%"
|
|
visible: {
|
|
if(control.indeterminate){
|
|
return false
|
|
}
|
|
return control.progressVisible
|
|
}
|
|
anchors{
|
|
left: parent.left
|
|
leftMargin: control.width+5
|
|
verticalCenter: parent.verticalCenter
|
|
}
|
|
}
|
|
}
|
|
|