-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCustomSwitch.qml
More file actions
37 lines (33 loc) · 1.05 KB
/
Copy pathCustomSwitch.qml
File metadata and controls
37 lines (33 loc) · 1.05 KB
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
import QtQuick 2.15
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import AppStyle 1.0
Switch {
id:control
property color backgroundColor: AppStyle.appStyle
indicator: Rectangle{
implicitHeight: 32
implicitWidth: 56
x:control.leftPadding
y:parent.height /2 - height/2
radius: width/2
color: control.checked ? control.backgroundColor : AppStyle.popupBackground
border.width: control.checked ? 2 : 1
border.color: control.checked ? control.backgroundColor : AppStyle.borderColor
Rectangle{
x:control.checked ? (parent.width-width) - 2: 2
width: 28
height: 28
radius: height/2
color: control.checked ? "#FFFFFF" : "#7a859b"
anchors.verticalCenter: parent.verticalCenter
}
}
contentItem: Label{
color: "#FFFFFF"
text: control.text
font.pixelSize: FontStyle.h3
verticalAlignment: Text.AlignVCenter
leftPadding: control.indicator.width + control.spacing
}
}