-
Notifications
You must be signed in to change notification settings - Fork 12
/
Turn.qml
47 lines (37 loc) · 1.09 KB
/
Turn.qml
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
45
46
47
import QtQuick 2.0
Item {
id: id_root
property bool isActive: false
onIsActiveChanged: {
canvas.requestPaint()
}
Canvas {
id: canvas
anchors.fill: parent
contextType: "2d"
antialiasing: true
onPaint: {
var context = canvas.getContext('2d');
if(isActive) context.fillStyle = "light green"
else context.fillStyle = "grey"
context.beginPath()
context.moveTo(0, id_root.height / 2)
context.lineTo(id_root.width / 3, 0)
context.lineTo(id_root.width / 3, id_root.height)
context.lineTo(0, id_root.height / 2)
context.closePath()
context.fill()
}
}
Rectangle {
id: id_rec
anchors {
left: id_root.left
leftMargin: id_root.width / 3.1
verticalCenter: id_root.verticalCenter
right: id_root.right
}
height: id_root.height * 0.5
color: isActive ? "light green" : "grey"
}
}