Changeset View
Changeset View
Standalone View
Standalone View
src/declarativeimports/plasmacomponents3/Slider.qml
Show All 22 Lines | |||||
23 | import "private" as Private | 23 | import "private" as Private | ||
24 | 24 | | |||
25 | T.Slider { | 25 | T.Slider { | ||
26 | id: control | 26 | id: control | ||
27 | 27 | | |||
28 | implicitWidth: control.orientation === Qt.Horizontal ? units.gridUnit * 12 : units.gridUnit * 1.6 | 28 | implicitWidth: control.orientation === Qt.Horizontal ? units.gridUnit * 12 : units.gridUnit * 1.6 | ||
29 | implicitHeight: control.orientation === Qt.Horizontal ? units.gridUnit * 1.6 : units.gridUnit * 12 | 29 | implicitHeight: control.orientation === Qt.Horizontal ? units.gridUnit * 1.6 : units.gridUnit * 12 | ||
30 | 30 | | |||
31 | property bool tickmarksEnabled : true | ||||
31 | wheelEnabled: true | 32 | wheelEnabled: true | ||
32 | snapMode: T.Slider.SnapOnRelease | 33 | snapMode: T.Slider.SnapOnRelease | ||
33 | 34 | | |||
34 | PlasmaCore.Svg { | 35 | PlasmaCore.Svg { | ||
35 | id: grooveSvg | 36 | id: grooveSvg | ||
36 | imagePath: "widgets/slider" | 37 | imagePath: "widgets/slider" | ||
37 | colorGroup: PlasmaCore.ColorScope.colorGroup | 38 | colorGroup: PlasmaCore.ColorScope.colorGroup | ||
38 | 39 | | |||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 90 | height: Math.max(margins.top + margins.bottom, | |||
90 | parent.horizontal | 91 | parent.horizontal | ||
91 | ? parent.height | 92 | ? parent.height | ||
92 | : parent.height - control.visualPosition * (parent.height + control.handle.height) + control.handle.height/2) | 93 | : parent.height - control.visualPosition * (parent.height + control.handle.height) + control.handle.height/2) | ||
93 | } | 94 | } | ||
94 | 95 | | |||
95 | Repeater { | 96 | Repeater { | ||
96 | id: repeater | 97 | id: repeater | ||
97 | readonly property int stepCount: (control.to - control.from) / control.stepSize | 98 | readonly property int stepCount: (control.to - control.from) / control.stepSize | ||
98 | model: control.stepSize && stepCount < 20 ? 1 + stepCount : 0 | 99 | model: tickmarksEnabled && control.stepSize && stepCount < 20 ? 1 + stepCount : 0 | ||
99 | anchors.fill: parent | 100 | anchors.fill: parent | ||
100 | 101 | | |||
101 | Rectangle { | 102 | Rectangle { | ||
102 | color: PlasmaCore.ColorScope.textColor | 103 | color: PlasmaCore.ColorScope.textColor | ||
103 | opacity: 0.3 | 104 | opacity: 0.3 | ||
104 | width: background.horizontal ? units.devicePixelRatio : units.gridUnit/2 | 105 | width: background.horizontal ? units.devicePixelRatio : units.gridUnit/2 | ||
105 | height: background.horizontal ? units.gridUnit/2 : units.devicePixelRatio | 106 | height: background.horizontal ? units.gridUnit/2 : units.devicePixelRatio | ||
106 | y: background.horizontal ? background.height + units.devicePixelRatio : handle.height / 2 + index * ((repeater.height - handle.height) / (repeater.count > 1 ? repeater.count - 1 : 1)) | 107 | y: background.horizontal ? background.height + units.devicePixelRatio : handle.height / 2 + index * ((repeater.height - handle.height) / (repeater.count > 1 ? repeater.count - 1 : 1)) | ||
107 | x: background.horizontal ? handle.width / 2 + index * ((repeater.width - handle.width) / (repeater.count > 1 ? repeater.count - 1 : 1)) : background.width | 108 | x: background.horizontal ? handle.width / 2 + index * ((repeater.width - handle.width) / (repeater.count > 1 ? repeater.count - 1 : 1)) : background.width | ||
108 | } | 109 | } | ||
109 | } | 110 | } | ||
110 | } | 111 | } | ||
111 | } | 112 | } |