BreatheProcess.qml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import QtQuick 2.11
  2. import QtQuick.Controls 2.14
  3. Item {
  4. id:root
  5. property int hideWith
  6. Loader{
  7. id:loader
  8. anchors.fill: parent
  9. }
  10. function show(text){
  11. loader.sourceComponent = undefined
  12. loader.sourceComponent = component
  13. loader.item.show()
  14. loader.item.text = text
  15. }
  16. function exit(){
  17. loader.sourceComponent = undefined
  18. }
  19. Component{
  20. id:component
  21. Item {
  22. id:item
  23. property alias text:fgtext.text
  24. function show(){
  25. animationShow.running = true
  26. }
  27. //加载任务动画效果
  28. NumberAnimation {
  29. id: animationShow
  30. target: item
  31. property: "x"
  32. from: root.hideWith
  33. to: 0
  34. duration: 500
  35. }
  36. Rectangle{
  37. id:bg
  38. anchors.fill: parent
  39. color: "black"
  40. opacity: 0.5
  41. radius: 4
  42. }
  43. Item {
  44. id:fg
  45. z:bg.z+1
  46. anchors.fill: parent
  47. Text {
  48. id: fgtext
  49. anchors.centerIn: parent
  50. color: "white"
  51. font.bold: true
  52. font.pixelSize: 18
  53. }
  54. }
  55. }
  56. }
  57. }