Add gitlab issue/merge request templates
[src/qtquickcontrols2-agl-style.git] / imports / qtquickcontrols2aglstyle / ProgressBar.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 import QtGraphicalEffects 1.0
20
21 T.ProgressBar {
22     id: control
23     implicitWidth: background.implicitWidth
24     implicitHeight: background.implicitHeight
25
26     background: Rectangle {
27         implicitWidth: 200
28         implicitHeight: 10
29         radius: control.height / 2
30         x: control.leftPadding
31         y: parent.height / 2 - height / 2
32         color: "#666666"
33     }
34
35     contentItem: Item {
36         implicitWidth: background.implicitWidth
37         implicitHeight: background.implicitHeight
38
39         Rectangle {
40             width: control.visualPosition * background.width
41             height: background.height
42             radius: background.radius
43             visible: !control.indeterminate
44         }
45
46         Rectangle {
47             visible: control.indeterminate
48             width: background.width * 0.1
49             height: background.height
50             radius: background.radius
51             NumberAnimation on x {
52                 from: 0
53                 to: background.width * 0.9
54                 duration: 2000
55                 loops: Animation.Infinite
56                 running: control.indeterminate
57                 easing.type: Easing.SineCurve
58             }
59         }
60
61         layer.enabled: true
62         layer.effect: LinearGradient {
63             start: Qt.point(0, 0)
64             end: Qt.point(background.width, 0)
65             gradient: Gradient {
66                 GradientStop { position: 0.0; color: "#00ADDC" }
67                 GradientStop { position: 1.0; color: "#6BFBFF" }
68             }
69         }
70     }
71 }