-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest2.qml
53 lines (50 loc) · 1.33 KB
/
test2.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
import QtQuick 2.6
import QtQuick.Controls 2.2
Rectangle {
anchors.fill: parent
color: "lightgrey"
ListView {
id: listExample
anchors.fill: parent
model: PersonModel
delegate:
Item {
width: 200
height: 60
Row {
Text {
width: 60
text: name + " " + age
horizontalAlignment: Text.AlignHCenter
anchors.verticalCenter: parent.verticalCenter
}
Button{
width: 20
text: "+"
onClicked: PersonModel.editPerson(index, name, age+1)
}
Button{
width: 20
text: "-"
onClicked: PersonModel.editPerson(index, name, age-1)
}
Button{
width: 20
text: "X"
onClicked: PersonModel.deletePerson(index)
}
}
}
}
Button {
width: 50
height: 25
anchors.bottom: parent.bottom
anchors.right: parent.right
text: "add"
onClicked: {
console.log("qml adding")
PersonModel.addPerson("luis", 22)
}
}
}