Drawer.qml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.Controls.impl
  6. import QtQuick.Templates as T
  7. T.Drawer {
  8. id: control
  9. parent: T.Overlay.overlay
  10. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  11. implicitContentWidth + leftPadding + rightPadding)
  12. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  13. implicitContentHeight + topPadding + bottomPadding)
  14. topPadding: SafeArea.margins.top + (control.edge === Qt.BottomEdge)
  15. leftPadding: SafeArea.margins.left + (control.edge === Qt.RightEdge)
  16. rightPadding: SafeArea.margins.right + (control.edge === Qt.LeftEdge)
  17. bottomPadding: SafeArea.margins.bottom + (control.edge === Qt.TopEdge)
  18. enter: Transition { SmoothedAnimation { velocity: 5 } }
  19. exit: Transition { SmoothedAnimation { velocity: 5 } }
  20. background: Rectangle {
  21. color: control.palette.window
  22. Rectangle {
  23. readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge
  24. width: horizontal ? 1 : parent.width
  25. height: horizontal ? parent.height : 1
  26. color: control.palette.dark
  27. x: control.edge === Qt.LeftEdge ? parent.width - 1 : 0
  28. y: control.edge === Qt.TopEdge ? parent.height - 1 : 0
  29. }
  30. }
  31. T.Overlay.modal: Rectangle {
  32. color: Color.transparent(control.palette.shadow, 0.5)
  33. }
  34. T.Overlay.modeless: Rectangle {
  35. color: Color.transparent(control.palette.shadow, 0.12)
  36. }
  37. }