PopupController.qml 840 B

123456789101112131415161718192021222324252627282930313233
  1. import QtQuick 2.15
  2. Item {
  3. id: root
  4. property Item target
  5. property bool opened: false
  6. property bool running: _trans.running
  7. property real shift: maxShift
  8. property real maxShift: 20
  9. property real duration: 0.25
  10. Binding { target: root.target; property: "visible"; value: root.opened || root.running }
  11. states: [
  12. State {
  13. name: "closed"; when: !root.opened
  14. PropertyChanges { target: root.target; opacity: 0 }
  15. PropertyChanges { target: root; shift: maxShift; }
  16. },
  17. State {
  18. name: "opened"; when: root.opened
  19. PropertyChanges { target: root.target; opacity: 1 }
  20. PropertyChanges { target: root; shift: 0; }
  21. }
  22. ]
  23. transitions: Transition {
  24. id: _trans
  25. NumberAnimation { properties: "shift, opacity"; duration: root.duration * 1000; easing.type: Easing.OutCubic }
  26. }
  27. }