blob: 6a46c9b6921da98e17ac8a26f67eb78b89798a83 (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
import QtQuick
import QtQuick.Shapes
Item {
width: 400
height: 600
ListModel {
id: renderers
ListElement { renderer: Shape.GeometryRenderer }
ListElement { renderer: Shape.CurveRenderer }
}
component ExampleShape : Shape {
anchors.fill: parent
preferredRendererType: renderer
ShapePath {
strokeWidth: 4
strokeColor: "black"
fillColor: "gray"
startX: 0; startY: 0
PathLine { x: 100; y: 0 }
PathLine { x: 100; y: 30 }
PathLine { x: 0; y: 30 }
PathLine { x: 0; y: 0 }
}
ShapePath {
strokeWidth: 2
strokeColor: "yellow"
fillColor: "transparent"
startX: 0; startY: 0
PathLine { x: 100; y: 30 }
}
z: -1
}
component ParentRect: Rectangle {
width: 150
height: 100
color: "transparent"
border.color: "blue"
border.width: 2
radius: 10
}
Row {
x: 10
y: 10
spacing: 20
Repeater {
model: renderers
Column {
spacing: 10
ParentRect {
ExampleShape {
}
}
ParentRect {
ExampleShape {
horizontalAlignment: Shape.AlignHCenter
verticalAlignment: Shape.AlignBottom
}
}
ParentRect {
ExampleShape {
horizontalAlignment: Shape.AlignHCenter
verticalAlignment: Shape.AlignVCenter
fillMode: Shape.PreserveAspectFit
}
}
ParentRect {
clip: true
ExampleShape {
horizontalAlignment: Shape.AlignHCenter
verticalAlignment: Shape.AlignVCenter
fillMode: Shape.PreserveAspectCrop
}
}
ParentRect {
ExampleShape {
horizontalAlignment: Shape.AlignHCenter
verticalAlignment: Shape.AlignBottom
fillMode: Shape.Stretch
}
}
}
}
}
}
|