-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriangle.qml
More file actions
47 lines (41 loc) · 1.15 KB
/
Triangle.qml
File metadata and controls
47 lines (41 loc) · 1.15 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
38
39
40
41
42
43
44
45
46
47
import QtQuick 2.15
import QtQuick.Shapes 1.15
Shape {
id: triangle
smooth: true
property color color: "#FFFFFF"
property alias border: borderItem
property bool rounded: false
property int align: Triangle.Align.Left
enum Align {
Left,
Center,
Right
}
Border {
id: borderItem
color: triangle.color
}
ShapePath {
id: triPath
property real peak: {
switch(triangle.align){
case Triangle.Align.Left: return 0
case Triangle.Align.Center: return triangle.width/2
case Triangle.Align.Right: return triangle.width
}
}
strokeColor: borderItem.color
strokeWidth: borderItem.width
fillColor: triangle.color
fillRule: ShapePath.WindingFill
capStyle: ShapePath.RoundCap
joinStyle: triangle.rounded ? ShapePath.RoundJoin : ShapePath.MiterJoin
miterLimit: 1000
startX: peak
startY: 0
PathLine { x:0 ; y: triangle.height }
PathLine { x: triangle.width; y: triangle.height }
PathLine { x: triPath.peak; y: 0 }
}
}