aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/modelviews/listview/dynamiclist.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/modelviews/listview/dynamiclist.qml')
-rw-r--r--examples/quick/modelviews/listview/dynamiclist.qml121
1 files changed, 70 insertions, 51 deletions
diff --git a/examples/quick/modelviews/listview/dynamiclist.qml b/examples/quick/modelviews/listview/dynamiclist.qml
index ee7c6329bc..e6d43a0d61 100644
--- a/examples/quick/modelviews/listview/dynamiclist.qml
+++ b/examples/quick/modelviews/listview/dynamiclist.qml
@@ -87,70 +87,84 @@ Rectangle {
Item {
id: delegateItem
- width: listView.width; height: 55
+ width: listView.width; height: 100
clip: true
- Row {
- anchors.verticalCenter: parent.verticalCenter
- spacing: 10
-
- Column {
- Image {
- source: "content/pics/arrow-up.png"
- MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index-1, 1) }
- }
- Image { source: "content/pics/arrow-down.png"
- MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index+1, 1) }
- }
+ Column {
+ id: arrows
+ anchors {
+ left: parent.left
+ verticalCenter: parent.verticalCenter
}
-
- Column {
- anchors.verticalCenter: parent.verticalCenter
-
- Text {
- text: name
- font.pixelSize: 15
- color: "white"
- }
- Row {
- spacing: 5
- Repeater {
- model: attributes
- Text { text: description; color: "White" }
- }
- }
+ Image {
+ source: "content/pics/arrow-up.png"
+ MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index-1, 1) }
+ }
+ Image { source: "content/pics/arrow-down.png"
+ MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index+1, 1) }
}
}
- Row {
- anchors.verticalCenter: parent.verticalCenter
- anchors.right: parent.right
- spacing: 10
-
- PressAndHoldButton {
- anchors.verticalCenter: parent.verticalCenter
- source: "content/pics/plus-sign.png"
- onClicked: fruitModel.setProperty(index, "cost", cost + 0.25)
+ Column {
+ anchors {
+ left: arrows.right
+ horizontalCenter: parent.horizontalCenter;
+ bottom: parent.verticalCenter
}
- Text {
- id: costText
- anchors.verticalCenter: parent.verticalCenter
- text: '$' + Number(cost).toFixed(2)
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: name
font.pixelSize: 15
color: "white"
- font.bold: true
}
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ spacing: 5
+ Repeater {
+ model: attributes
+ Text { text: description; color: "White" }
+ }
+ }
+ }
- PressAndHoldButton {
- anchors.verticalCenter: parent.verticalCenter
- source: "content/pics/minus-sign.png"
- onClicked: fruitModel.setProperty(index, "cost", Math.max(0,cost-0.25))
+ Item {
+ anchors {
+ left: arrows.right
+ horizontalCenter: parent.horizontalCenter;
+ top: parent.verticalCenter
+ bottom: parent.bottom
}
- Image {
- source: "content/pics/list-delete.png"
- MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) }
+ Row {
+ anchors.centerIn: parent
+ spacing: 10
+
+ PressAndHoldButton {
+ anchors.verticalCenter: parent.verticalCenter
+ source: "content/pics/plus-sign.png"
+ onClicked: fruitModel.setProperty(index, "cost", cost + 0.25)
+ }
+
+ Text {
+ id: costText
+ anchors.verticalCenter: parent.verticalCenter
+ text: '$' + Number(cost).toFixed(2)
+ font.pixelSize: 15
+ color: "white"
+ font.bold: true
+ }
+
+ PressAndHoldButton {
+ anchors.verticalCenter: parent.verticalCenter
+ source: "content/pics/minus-sign.png"
+ onClicked: fruitModel.setProperty(index, "cost", Math.max(0,cost-0.25))
+ }
+
+ Image {
+ source: "content/pics/list-delete.png"
+ MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) }
+ }
}
}
@@ -174,12 +188,17 @@ Rectangle {
// The view:
ListView {
id: listView
- anchors.fill: parent; anchors.margins: 20
+ anchors {
+ left: parent.left; top: parent.top;
+ right: parent.right; bottom: buttons.top;
+ margins: 20
+ }
model: fruitModel
delegate: listDelegate
}
Row {
+ id: buttons
anchors { left: parent.left; bottom: parent.bottom; margins: 20 }
spacing: 10