SwipeDelegate.qml 1.6 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.Templates as T
  6. import QtQuick.Controls.impl
  7. import QtQuick.Controls.Fusion
  8. import QtQuick.Controls.Fusion.impl
  9. T.SwipeDelegate {
  10. id: control
  11. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  12. implicitContentWidth + leftPadding + rightPadding)
  13. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  14. implicitContentHeight + topPadding + bottomPadding,
  15. implicitIndicatorHeight + topPadding + bottomPadding)
  16. padding: 6
  17. spacing: 6
  18. icon.width: 16
  19. icon.height: 16
  20. swipe.transition: Transition { SmoothedAnimation { velocity: 3; easing.type: Easing.InOutCubic } }
  21. contentItem: IconLabel {
  22. spacing: control.spacing
  23. mirrored: control.mirrored
  24. display: control.display
  25. alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft
  26. icon: control.icon
  27. text: control.text
  28. font: control.font
  29. color: control.highlighted ? Fusion.highlightedText(control.palette) : control.palette.text
  30. }
  31. background: Rectangle {
  32. implicitWidth: 100
  33. implicitHeight: 20
  34. color: control.down ? Fusion.buttonColor(control.palette, false, true, true)
  35. : control.highlighted ? Fusion.highlight(control.palette) : control.palette.base
  36. }
  37. }