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