-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRoundedRectangle.qml
62 lines (58 loc) · 2.84 KB
/
RoundedRectangle.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import QtQuick 2.0
Rectangle {
id: root
property int radiusCorners: Qt.AlignLeft | Qt.AlignRight | Qt.AlignTop | Qt.AlignBottom /* Default: */
/*
Qt.AlignLeft | Qt.AlignLeft | Qt.AlignRight | Qt.AlignLeft | Qt.AlignLeft |
Qt.AlignRight | Qt.AlignTop | Qt.AlignTop | Qt.AlignRight | Qt.AlignRight |
None:0 Qt.AlignTop | Qt.AlignBottom Qt.AlignBottom Qt.AlignTop Qt.AlignBottom
Qt.AlignBottom
***************** ************* *************** *************** ************* *****************
* * * * * * * * * * * *
* * * * * * * * * * * *
* * * * * * * * * * * *
* * * * * * * * * * * *
* * * * * * * * * * * *
* * * * * * * * * * * *
* * * * * * * * * * * *
***************** ************* *************** *************** ***************** *************
*/
Repeater {
model: [ {
x: 0,
y: 0,
visible: internal.aligns(Qt.AlignLeft | Qt.AlignTop),
radius: root.radius
},
{
x: root.width - root.radius,
y: 0,
visible: internal.aligns(Qt.AlignRight | Qt.AlignTop),
radius: root.radius
},
{
x: 0,
y: root.height - root.radius,
visible: internal.aligns(Qt.AlignLeft | Qt.AlignBottom),
radius: root.radius
},
{
x: root.width - root.radius,
y: root.height - root.radius,
visible: internal.aligns(Qt.AlignRight | Qt.AlignBottom),
radius: root.radius
} ]
Rectangle {
x: modelData.x; y: modelData.y
width: modelData.radius; height: width
visible: !modelData.visible
color: parent.color
}
}
QtObject {
id: internal
function aligns(direction) {
return (root.radiusCorners & direction) === direction
}
}
}