blob: 49638683e4bae5990084e94079f0bc59d80d38b1 (
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
|
import QtQuick 2.0
Rectangle {
width: 400
height: 100
// Create row with four rectangles, the fourth one is hidden
Row {
id: row
Rectangle {
id: red
color: "red"
width: 100
height: 100
// When mouse is clicked, display the values of the positioner
MouseArea {
anchors.fill: parent
onClicked: row.showInfo(red.Positioner)
}
}
Rectangle {
id: green
color: "green"
width: 100
height: 100
// When mouse is clicked, display the values of the positioner
MouseArea {
anchors.fill: parent
onClicked: row.showInfo(green.Positioner)
}
}
Rectangle {
id: blue
color: "blue"
width: 100
height: 100
// When mouse is clicked, display the values of the positioner
MouseArea {
anchors.fill: parent
onClicked: row.showInfo(blue.Positioner)
}
}
// This rectangle is not visible, so it doesn't have a positioner value
Rectangle {
color: "black"
width: 100
height: 100
visible: false
}
// Print the index of the child item in the positioner and convenience
// properties showing if it's the first or last item.
function showInfo(positioner) {
console.log("Item Index = " + positioner.index)
console.log(" isFirstItem = " + positioner.isFirstItem)
console.log(" isLastItem = " + positioner.isLastItem)
}
}
}
|