blob: 9b7014dd13416589dc07a93de19fc10a5326db2f (
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
40
41
42
43
44
|
import QtQuick
import QtQuick.Controls
CheckBox {
id: control
contentItem: Text {
text: control.text
color: Theme.text
font.family: Theme.mainFont
font.pixelSize: 13
verticalAlignment: Text.AlignVCenter
leftPadding: control.indicator.width + control.spacing
}
indicator: Rectangle {
implicitWidth: 14
implicitHeight: 14
x: control.leftPadding
y: Math.round((control.height - height) / 2)
radius: 3.5
color: control.checked ? Theme.accent : Theme.surface
border.color: control.checked ? Theme.accent : Theme.border
border.width: 1
Canvas {
anchors.fill: parent
visible: control.checked
onPaint: {
var ctx = getContext("2d");
ctx.reset();
ctx.lineWidth = 1.5;
ctx.strokeStyle = "white";
ctx.lineCap = "round";
ctx.lineJoin = "round";
ctx.beginPath();
ctx.moveTo(3, 7);
ctx.lineTo(6, 10);
ctx.lineTo(11, 4);
ctx.stroke();
}
}
}
}
|