Warning, /plasma/qqc2-breeze-style/style/qtquickcontrols/Dial.qml is written in an unsupported language. File is not indexed.
0001 /* SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com> 0002 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0003 */ 0004 0005 import QtQuick 0006 import QtQml 0007 import QtQuick.Controls as Controls 0008 import QtQuick.Controls.impl 0009 import QtQuick.Templates as T 0010 import org.kde.kirigami as Kirigami 0011 import org.kde.breeze 0012 import org.kde.breeze.impl as Impl 0013 0014 T.Dial { 0015 id: control 0016 0017 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, 0018 implicitContentWidth + leftPadding + rightPadding) 0019 implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, 0020 implicitContentHeight + topPadding + bottomPadding) 0021 0022 inputMode: !Kirigami.Settings.tabletMode ? Dial.Vertical : Dial.Circular 0023 0024 Kirigami.Theme.colorSet: Kirigami.Theme.Button 0025 Kirigami.Theme.inherit: false 0026 0027 background: Impl.BreezeDial { 0028 implicitWidth: 100 0029 implicitHeight: 100 0030 backgroundBorderColor: Impl.Theme.separatorColor() 0031 backgroundColor: Kirigami.Theme.backgroundColor 0032 fillBorderColor: Kirigami.Theme.focusColor 0033 fillColor: Kirigami.Theme.alternateBackgroundColor 0034 angle: control.angle 0035 grooveThickness: Impl.Units.grooveHeight 0036 Behavior on angle { 0037 enabled: !Kirigami.Settings.hasTransientTouchInput 0038 SmoothedAnimation { 0039 duration: Kirigami.Units.longDuration 0040 velocity: 800 0041 //SmoothedAnimations have a hardcoded InOutQuad easing 0042 } 0043 } 0044 } 0045 0046 handle: Kirigami.ShadowedRectangle { 0047 id: handle 0048 property real grooveOffset: Impl.Units.grooveHeight * 4 0049 x: control.background.x + (control.background.width - control.handle.width) / 2 0050 y: control.background.y + (control.background.height - control.handle.height) / 2 0051 implicitWidth: implicitHeight 0052 implicitHeight: 100 - grooveOffset + 2 0053 width: height 0054 height: { 0055 let bgExtent = Math.min(control.background.width, control.background.height) 0056 let handleExtent = bgExtent 0057 if (bgExtent - grooveOffset <= grooveOffset*2) { 0058 handleExtent -= grooveOffset/2 - 2 0059 } else { 0060 handleExtent -= grooveOffset - 2 0061 } 0062 return handleExtent 0063 } 0064 radius: height/2 0065 0066 color: Kirigami.Theme.backgroundColor 0067 0068 border { 0069 width: Impl.Units.smallBorder 0070 color: control.hovered || control.pressed || control.visualFocus 0071 ? Kirigami.Theme.focusColor : Impl.Theme.separatorColor() 0072 } 0073 0074 shadow { 0075 color: control.pressed ? "transparent" : Qt.rgba(0,0,0,0.2) 0076 size: control.enabled ? Math.round(handle.height/10 + 1) : 0 0077 yOffset: Math.round(Math.round(handle.height/10 + 1) / 4) 0078 } 0079 0080 Kirigami.ShadowedRectangle { 0081 anchors.fill: parent 0082 anchors.margins: parent.border.width 0083 color: parent.color 0084 radius: height/2 0085 rotation: control.angle 0086 Behavior on rotation { 0087 enabled: !Kirigami.Settings.hasTransientTouchInput 0088 SmoothedAnimation { 0089 duration: Kirigami.Units.longDuration 0090 velocity: 800 0091 //SmoothedAnimations have a hardcoded InOutQuad easing 0092 } 0093 } 0094 Rectangle { 0095 id: handleDot 0096 radius: width/2 0097 anchors.verticalCenter: parent.top 0098 anchors.horizontalCenter: parent.horizontalCenter 0099 anchors.verticalCenterOffset: height 0100 width: 4 0101 height: 4 0102 color: control.enabled ? Kirigami.Theme.focusColor : Impl.Theme.separatorColor() 0103 } 0104 } 0105 0106 Behavior on border.color { 0107 enabled: control.hovered || control.pressed || control.visualFocus 0108 ColorAnimation { 0109 duration: Kirigami.Units.shortDuration 0110 easing.type: Easing.OutCubic 0111 } 0112 } 0113 0114 Behavior on shadow.color { 0115 enabled: control.pressed 0116 ColorAnimation { 0117 duration: Kirigami.Units.shortDuration 0118 easing.type: Easing.OutCubic 0119 } 0120 } 0121 0122 Impl.FocusRect { 0123 z: -1 0124 baseRadius: parent.radius 0125 visible: control.visualFocus 0126 } 0127 0128 Rectangle { 0129 radius: parent.radius 0130 opacity: control.pressed || control.hovered ? 0 : 1 0131 visible: control.enabled 0132 anchors.fill: parent 0133 anchors.margins: parent.border.width 0134 gradient: Gradient { 0135 GradientStop { 0136 position: 0 0137 color: Qt.rgba(1,1,1,0.03125) 0138 } 0139 GradientStop { 0140 position: 1 0141 color: Qt.rgba(0,0,0,0.0625) 0142 } 0143 } 0144 Behavior on opacity { 0145 OpacityAnimator { 0146 duration: Kirigami.Units.shortDuration 0147 easing.type: Easing.OutCubic 0148 } 0149 } 0150 } 0151 } 0152 }