DefaultSlider.qml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (C) 2020 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
  6. import QtQuick.Templates as T
  7. import QtQuick.NativeStyle as NativeStyle
  8. T.Slider {
  9. id: control
  10. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  11. implicitHandleWidth + leftPadding + rightPadding,
  12. control.horizontal ? 90 : 0 /* minimum */ )
  13. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  14. implicitHandleHeight + topPadding + bottomPadding,
  15. control.vertical ? 90 : 0 /* minimum */ )
  16. readonly property bool __notCustomizable: true
  17. background: NativeStyle.Slider {
  18. control: control
  19. subControl: NativeStyle.Slider.Groove
  20. // We normally cannot use a nine patch image for the
  21. // groove if we draw tickmarks (since then the scaling
  22. // would scale the tickmarks too). The groove might
  23. // also use a different background color before, and
  24. // after, the handle.
  25. useNinePatchImage: false
  26. readonly property bool __ignoreNotCustomizable: true
  27. }
  28. handle: NativeStyle.Slider {
  29. control: control
  30. subControl: NativeStyle.Slider.Handle
  31. x: control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
  32. y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))
  33. useNinePatchImage: false
  34. readonly property bool __ignoreNotCustomizable: true
  35. }
  36. }