SwipeDelegate.qml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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.Universal
  8. T.SwipeDelegate {
  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. implicitIndicatorHeight + topPadding + bottomPadding)
  15. spacing: 12
  16. padding: 12
  17. topPadding: padding - 1
  18. bottomPadding: padding + 1
  19. icon.width: 20
  20. icon.height: 20
  21. icon.color: Color.transparent(Universal.foreground, enabled ? 1.0 : 0.2)
  22. swipe.transition: Transition { SmoothedAnimation { velocity: 3; easing.type: Easing.InOutCubic } }
  23. contentItem: IconLabel {
  24. spacing: control.spacing
  25. mirrored: control.mirrored
  26. display: control.display
  27. alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft
  28. icon: control.icon
  29. text: control.text
  30. font: control.font
  31. color: Color.transparent(control.Universal.foreground, enabled ? 1.0 : 0.2)
  32. }
  33. background: Rectangle {
  34. color: control.Universal.background
  35. Rectangle {
  36. width: parent.width
  37. height: parent.height
  38. color: control.down ? control.Universal.listMediumColor :
  39. enabled && control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor
  40. Rectangle {
  41. width: parent.width
  42. height: parent.height
  43. visible: control.visualFocus || control.highlighted
  44. color: control.Universal.accent
  45. opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
  46. }
  47. }
  48. }
  49. }