Guest User

Untitled

a guest
Jun 30th, 2020
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. import QtQuick 2.12
  2. import QtQuick.Controls 2.12
  3. import QtQuick.Shapes 1.15
  4.  
  5. ApplicationWindow {
  6. visible: true
  7. width: 640
  8. height: 480
  9. title: qsTr("Hello World")
  10. Timer {
  11. id: worker;
  12. interval: Math.random() * 2000
  13. onTriggered: {
  14. rotationAnimation.stop();
  15. }
  16. }
  17.  
  18. Rectangle {
  19. width: 200
  20. height: 200
  21. anchors.centerIn: parent
  22. Button {
  23. anchors.fill: parent
  24. id: button
  25. icon.source: "https://image.flaticon.com/icons/svg/860/860822.svg"
  26. icon.width: parent.width*0.9
  27. icon.height: parent.height*0.9
  28. background: Rectangle {
  29. color: "transparent"
  30. }
  31. RotationAnimator {
  32. id: rotationAnimation
  33. target: button;
  34. from: 0;
  35. to: -360;
  36. duration: 500
  37. // infinite run - alwaysRunToEnd: true
  38. loops: Animation.Infinite
  39. }
  40. onClicked: {
  41. rotationAnimation.start();
  42. worker.start()
  43. }
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment