Dial.qml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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.Controls.impl
  6. import QtQuick.Controls.Basic.impl
  7. import QtQuick.Templates as T
  8. T.Dial {
  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. background: DialImpl {
  15. implicitWidth: 184
  16. implicitHeight: 184
  17. color: control.visualFocus ? control.palette.highlight : control.palette.dark
  18. progress: control.position
  19. opacity: control.enabled ? 1 : 0.3
  20. startAngle: control.startAngle
  21. endAngle: control.endAngle
  22. }
  23. handle: ColorImage {
  24. x: control.background.x + control.background.width / 2 - width / 2
  25. y: control.background.y + control.background.height / 2 - height / 2
  26. width: 14
  27. height: 10
  28. defaultColor: "#353637"
  29. color: control.visualFocus ? control.palette.highlight : control.palette.dark
  30. source: "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/dial-indicator.png"
  31. antialiasing: true
  32. opacity: control.enabled ? 1 : 0.3
  33. transform: [
  34. Translate {
  35. y: -Math.min(control.background.width, control.background.height) * 0.4
  36. + (control.handle ? control.handle.height / 2 : 0)
  37. },
  38. Rotation {
  39. angle: control.angle
  40. origin.x: control.handle ? control.handle.width / 2 : 0
  41. origin.y: control.handle ? control.handle.height / 2 : 0
  42. }
  43. ]
  44. }
  45. }