Popup.qml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright (C) 2017 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
  3. // Qt-Security score:significant reason:default
  4. import QtQuick
  5. import QtQuick.Templates as T
  6. import QtQuick.Controls.Material
  7. import QtQuick.Controls.Material.impl
  8. T.Popup {
  9. id: control
  10. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  11. implicitContentWidth + leftPadding + rightPadding)
  12. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  13. implicitContentHeight + topPadding + bottomPadding)
  14. padding: 12
  15. Material.elevation: 4
  16. Material.roundedScale: Material.ExtraSmallScale
  17. enter: Transition {
  18. // grow_fade_in
  19. NumberAnimation { property: "scale"; from: 0.9; to: 1.0; easing.type: Easing.OutQuint; duration: 220 }
  20. NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.OutCubic; duration: 150 }
  21. }
  22. exit: Transition {
  23. // shrink_fade_out
  24. NumberAnimation { property: "scale"; from: 1.0; to: 0.9; easing.type: Easing.OutQuint; duration: 220 }
  25. NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.OutCubic; duration: 150 }
  26. }
  27. background: Rectangle {
  28. // FullScale doesn't make sense for Popup.
  29. radius: control.Material.roundedScale
  30. color: control.Material.dialogColor
  31. layer.enabled: control.Material.elevation > 0
  32. layer.effect: RoundedElevationEffect {
  33. elevation: control.Material.elevation
  34. roundedScale: control.Material.roundedScale
  35. }
  36. }
  37. T.Overlay.modal: Rectangle {
  38. color: control.Material.backgroundDimColor
  39. Behavior on opacity { NumberAnimation { duration: 150 } }
  40. }
  41. T.Overlay.modeless: Rectangle {
  42. color: control.Material.backgroundDimColor
  43. Behavior on opacity { NumberAnimation { duration: 150 } }
  44. }
  45. }