Initial import from CES2017 repository
[src/qtquickcontrols2-agl-style.git] / imports / qtquickcontrols2aglstyle / Slider.qml
1 /*
2  * Copyright (C) 2016 The Qt Company Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 import QtQuick 2.6
18 import QtQuick.Templates 2.0 as T
19
20 T.Slider {
21     id: root
22     implicitWidth: background.implicitWidth
23     implicitHeight: handle.implicitHeight
24
25     background: Rectangle {
26         implicitWidth: 200
27         height: 10
28         radius: height / 2
29         x: root.leftPadding
30         y: parent.height / 2 - height / 2
31         color: "#666666"
32
33         Rectangle {
34             rotation: -90
35             transformOrigin: Item.TopLeft
36             y: parent.height
37             width: parent.height
38             height: handle.x + handle.width
39             radius: width / 2
40             gradient: Gradient {
41                 GradientStop { position: 0.0; color: '#59FF7F' }
42                 GradientStop { position: 1.0; color: '#6BFBFF' }
43             }
44         }
45     }
46
47     handle: Rectangle {
48         x: root.leftPadding + root.visualPosition * (root.availableWidth - width)
49         y: root.topPadding + root.availableHeight / 2 - height / 2
50         implicitWidth: implicitHeight
51         implicitHeight: 50
52         radius: implicitHeight / 2
53         color: root.pressed ? "#f0f0f0" : "#f6f6f6"
54         border.color: "#bdbebf"
55     }
56 }