blob: 6219bf231e46e4940222cab34484f018f9008455 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Templates as T
import "."
T.Switch {
id: control
implicitWidth: 48
implicitHeight: 26
indicator: Rectangle {
x: control.visualPosition * (control.width - width)
y: (control.height - height) / 2
width: 26
height: 26
radius: 13
color: control.down ? UIStyle.themeColorQtGray6 : UIStyle.themeColorQtGray10
border.color: !control.checked ? "#999999"
: (control.down ? UIStyle.colorQtAuxGreen2
: UIStyle.colorQtAuxGreen1)
Behavior on x {
enabled: !control.pressed
SmoothedAnimation { velocity: 200 }
}
}
background: Rectangle {
radius: 13
color: control.checked ? UIStyle.colorQtAuxGreen2 : UIStyle.colorRed
border.color: control.checked ? UIStyle.colorQtAuxGreen2
: UIStyle.themeColorQtGray6
}
}
|