BusyIndicator.qml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import QtQuick 2.12
  2. import QtQuick.Controls 2.12
  3. Item {
  4. id: control
  5. contentItem: Item {
  6. implicitWidth: 64
  7. implicitHeight: 64
  8. Item {
  9. id: item
  10. x: parent.width / 2 - 32
  11. y: parent.height / 2 - 32
  12. width: 64
  13. height: 64
  14. opacity: control.running ? 1 : 0
  15. Behavior on opacity {
  16. OpacityAnimator {
  17. duration: 250
  18. }
  19. }
  20. RotationAnimator {
  21. target: item
  22. running: control.visible && control.running
  23. from: 0
  24. to: 360
  25. loops: Animation.Infinite
  26. duration: 1250
  27. }
  28. Repeater {
  29. id: repeater
  30. model: 6
  31. Rectangle {
  32. x: item.width / 2 - width / 2
  33. y: item.height / 2 - height / 2
  34. implicitWidth: 10
  35. implicitHeight: 10
  36. radius: 5
  37. color: "#21be2b"
  38. transform: [
  39. Translate {
  40. y: -Math.min(item.width, item.height) * 0.5 + 5
  41. },
  42. Rotation {
  43. angle: index / repeater.count * 360
  44. origin.x: 5
  45. origin.y: 5
  46. }
  47. ]
  48. }
  49. }
  50. }
  51. }
  52. }