1
0

DwSlider.qml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. import "." as Components
  4. // Slider with the ember handle — a 28px handle is grabbable with a fingertip.
  5. Slider {
  6. id: control
  7. implicitHeight: Components.ThemeManager.touchTarget
  8. background: Rectangle {
  9. x: control.leftPadding
  10. y: control.topPadding + control.availableHeight / 2 - height / 2
  11. width: control.availableWidth
  12. height: 6
  13. radius: 3
  14. color: Components.ThemeManager.pressedColor
  15. Rectangle {
  16. width: control.visualPosition * parent.width
  17. height: parent.height
  18. radius: 3
  19. color: Components.ThemeManager.accent
  20. }
  21. }
  22. handle: Rectangle {
  23. x: control.leftPadding + control.visualPosition * (control.availableWidth - width)
  24. y: control.topPadding + control.availableHeight / 2 - height / 2
  25. width: 28
  26. height: 28
  27. radius: 14
  28. color: control.pressed ? Components.ThemeManager.accentPressed
  29. : Components.ThemeManager.accent
  30. }
  31. }