import QtQuick 2.9
Rectangle{
color: "transparent"
width: 100
height: 100
BusyIndicator{
anchors.centerIn: parent
implicitWidth: 96
implicitHeight: 96
}
}
新建qml文件:BusyIndicator.xml
import QtQuick 2.9
import QtGraphicalEffects 1.0
Item
{
Rectangle
{ id: rect
width: parent.width
height: parent.height
color: Qt.rgba(0, 0, 0, 0)
radius: width / 2
border.width: width / 6
visible: false
}
ConicalGradient
{
width: rect.width
height: rect.height
gradient: Gradient
{ GradientStop
{ position: 0.0; color: "#80c342" }
GradientStop
{
position: 1.0;
color: "#006325"
}
}
source: rect
Rectangle {
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
width: rect.border.width
height: width
radius: width / 2
color: "#006325"
}
RotationAnimation on rotation {
from: 0
to: 360
duration: 800
loops: Animation.Infinite
}
}
}
相关的:
https://blog.youkuaiyun.com/liang19890820/article/details/51029602
https://blog.youkuaiyun.com/work4blue/article/details/45923601