Dial.qml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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.Dial {
  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. background: DialImpl {
  16. implicitWidth: 100
  17. implicitHeight: 100
  18. highlight: control.visualFocus
  19. }
  20. handle: KnobImpl {
  21. x: control.background.x + control.background.width / 2 - width / 2
  22. y: control.background.y + control.background.height / 2 - height / 2
  23. width: control.width / 7
  24. height: control.height / 7
  25. transform: [
  26. Translate {
  27. y: -Math.min(control.background.width, control.background.height) * 0.35
  28. + (control.handle ? control.handle.height / 2 : 0)
  29. },
  30. Rotation {
  31. angle: control.angle
  32. origin.x: control.handle ? control.handle.width / 2 : 0
  33. origin.y: control.handle ? control.handle.height / 2 : 0
  34. }
  35. ]
  36. }
  37. }