summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-27 05:11:40 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-27 05:11:40 (GMT)
commita8fb485e1f2a7c2d6de913a2f0b3809b95c47e36 (patch)
treefcdeb8dee41ad3b84b8265a997a320426b20c241 /examples
parentbc363b7c4819e1e4837079d6e6489654dee7de97 (diff)
parente6d3632493112fce4244fceb1a864814b8cc3b43 (diff)
downloadQt-a8fb485e1f2a7c2d6de913a2f0b3809b95c47e36.zip
Qt-a8fb485e1f2a7c2d6de913a2f0b3809b95c47e36.tar.gz
Qt-a8fb485e1f2a7c2d6de913a2f0b3809b95c47e36.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/listview/content/pics/archive-insert.pngbin0 -> 896 bytes
-rw-r--r--examples/declarative/listview/content/pics/archive-remove.pngbin0 -> 1074 bytes
-rw-r--r--examples/declarative/listview/content/pics/go-down.pngbin0 -> 892 bytes
-rw-r--r--examples/declarative/listview/content/pics/go-up.pngbin0 -> 929 bytes
-rw-r--r--examples/declarative/listview/content/pics/list-add.pngbin0 -> 907 bytes
-rw-r--r--examples/declarative/listview/content/pics/list-remove.pngbin0 -> 498 bytes
-rw-r--r--examples/declarative/listview/dynamic.qml108
7 files changed, 52 insertions, 56 deletions
diff --git a/examples/declarative/listview/content/pics/archive-insert.png b/examples/declarative/listview/content/pics/archive-insert.png
new file mode 100644
index 0000000..b706248
--- /dev/null
+++ b/examples/declarative/listview/content/pics/archive-insert.png
Binary files differ
diff --git a/examples/declarative/listview/content/pics/archive-remove.png b/examples/declarative/listview/content/pics/archive-remove.png
new file mode 100644
index 0000000..9640f6b
--- /dev/null
+++ b/examples/declarative/listview/content/pics/archive-remove.png
Binary files differ
diff --git a/examples/declarative/listview/content/pics/go-down.png b/examples/declarative/listview/content/pics/go-down.png
new file mode 100644
index 0000000..63331a5
--- /dev/null
+++ b/examples/declarative/listview/content/pics/go-down.png
Binary files differ
diff --git a/examples/declarative/listview/content/pics/go-up.png b/examples/declarative/listview/content/pics/go-up.png
new file mode 100644
index 0000000..4459024
--- /dev/null
+++ b/examples/declarative/listview/content/pics/go-up.png
Binary files differ
diff --git a/examples/declarative/listview/content/pics/list-add.png b/examples/declarative/listview/content/pics/list-add.png
new file mode 100644
index 0000000..e029787
--- /dev/null
+++ b/examples/declarative/listview/content/pics/list-add.png
Binary files differ
diff --git a/examples/declarative/listview/content/pics/list-remove.png b/examples/declarative/listview/content/pics/list-remove.png
new file mode 100644
index 0000000..2bb1a59
--- /dev/null
+++ b/examples/declarative/listview/content/pics/list-remove.png
Binary files differ
diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml
index f48cc4e..78346f3 100644
--- a/examples/declarative/listview/dynamic.qml
+++ b/examples/declarative/listview/dynamic.qml
@@ -1,54 +1,48 @@
import Qt 4.6
import "content"
-Item {
- width: 320
- height: 500
+Rectangle {
+ width: 640; height: 480
+ color: "#343434"
ListModel {
id: fruitModel
ListElement {
- name: "Apple"
- cost: 2.45
+ name: "Apple"; cost: 2.45
attributes: [
ListElement { description: "Core" },
ListElement { description: "Deciduous" }
]
}
ListElement {
- name: "Banana"
- cost: 1.95
+ name: "Banana"; cost: 1.95
attributes: [
ListElement { description: "Tropical" },
ListElement { description: "Seedless" }
]
}
ListElement {
- name: "Cumquat"
- cost: 3.25
+ name: "Cumquat"; cost: 3.25
types: [ "Small", "Smaller" ]
attributes: [
ListElement { description: "Citrus" }
]
}
ListElement {
- name: "Durian"
- cost: 9.95
+ name: "Durian"; cost: 9.95
attributes: [
ListElement { description: "Tropical" },
ListElement { description: "Smelly" }
]
}
ListElement {
- name: "Elderberry"
- cost: 0.05
+ name: "Elderberry"; cost: 0.05
attributes: [
ListElement { description: "Berry" }
]
}
ListElement {
- name: "Fig"
- cost: 0.25
+ name: "Fig"; cost: 0.25
attributes: [
ListElement { description: "Flower" }
]
@@ -59,83 +53,85 @@ Item {
id: fruitDelegate
Item {
width: parent.width; height: 55
- Text { id: label; font.pixelSize: 24; text: name; elide: "ElideRight"; anchors.right: costText.left; anchors.left:parent.left }
- Text { id: costText; font.pixelSize: 24; text: '$'+Number(cost).toFixed(2); anchors.right: itemButtons.left }
- Row {
- anchors.top: label.bottom
- spacing: 5
- Repeater {
- model: attributes
- Component {
- Text { text: description }
- }
+
+ Column {
+ id: moveButtons; x: 5; width: childrenRect.width; anchors.verticalCenter: parent.verticalCenter
+ Image { source: "content/pics/go-up.png"
+ MouseRegion { anchors.fill: parent; onClicked: fruitModel.move(index,index-1,1) }
+ }
+ Image { source: "content/pics/go-down.png"
+ MouseRegion { anchors.fill: parent; onClicked: fruitModel.move(index,index+1,1) }
+ }
+ }
+
+ Column {
+ anchors { right: itemButtons.left; verticalCenter: parent.verticalCenter; left: moveButtons.right; leftMargin: 10 }
+ Text {
+ id: label; font.bold: true; text: name; elide: Text.ElideRight; font.pixelSize: 15
+ width: parent.width; color: "White"
+ }
+ Row {
+ spacing: 5
+ Repeater { model: attributes; Component { Text { text: description; color: "White" } } }
}
}
+
Row {
id: itemButtons
- anchors.right: parent.right
- width: childrenRect.width
- Image { source: "content/pics/add.png"
+ anchors.right: removeButton.left; anchors.rightMargin: 35; spacing: 10
+ width: childrenRect.width; anchors.verticalCenter: parent.verticalCenter
+ Image { source: "content/pics/list-add.png"
ClickAutoRepeating { id: clickUp; anchors.fill: parent; onClicked: fruitModel.set(index,"cost",Number(cost)+0.25) }
- scale: clickUp.isPressed ? 0.9 : 1
+ scale: clickUp.isPressed ? 0.9 : 1; transformOrigin: Item.Center
}
- Image { source: "content/pics/del.png"
+ Text { id: costText; text: '$'+Number(cost).toFixed(2); font.pixelSize: 15; color: "White"; font.bold: true; }
+ Image { source: "content/pics/list-remove.png"
ClickAutoRepeating { id: clickDown; anchors.fill: parent; onClicked: fruitModel.set(index,"cost",Math.max(0,Number(cost)-0.25)) }
- scale: clickDown.isPressed ? 0.9 : 1
- }
- Image { source: "content/pics/trash.png"
- MouseRegion { anchors.fill: parent; onClicked: fruitModel.remove(index) }
- }
- Column {
- width: childrenRect.width
- Image { source: "content/pics/moreUp.png"
- MouseRegion { anchors.fill: parent; onClicked: fruitModel.move(index,index-1,1) }
- }
- Image { source: "content/pics/moreDown.png"
- MouseRegion { anchors.fill: parent; onClicked: fruitModel.move(index,index+1,1) }
- }
+ scale: clickDown.isPressed ? 0.9 : 1; transformOrigin: Item.Center
}
}
+ Image {
+ id: removeButton; source: "content/pics/archive-remove.png"
+ anchors { verticalCenter: parent.verticalCenter; right: parent.right; rightMargin: 10 }
+ MouseRegion { anchors.fill:parent; onClicked: fruitModel.remove(index) }
+ }
}
}
ListView {
- model: fruitModel
- delegate: fruitDelegate
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: buttons.top
+ model: fruitModel; delegate: fruitDelegate
+ anchors { top: parent.top; left: parent.left; right: parent.right; bottom: buttons.top }
}
Row {
- width: childrenRect.width
+ x: 8; width: childrenRect.width
height: childrenRect.height
- anchors.bottom: parent.bottom
+ anchors { bottom: parent.bottom; bottomMargin: 8 }
+ spacing: 8
id: buttons
- Image { source: "content/pics/add.png"
+ Image { source: "content/pics/archive-insert.png"
MouseRegion { anchors.fill: parent;
onClicked: {
fruitModel.append({
"name":"Pizza Margarita",
"cost":5.95,
"attributes":[{"description": "Cheese"},{"description": "Tomato"}]
- })
+ })
}
}
}
- Image { source: "content/pics/add.png"
+ Image { source: "content/pics/archive-insert.png"
MouseRegion { anchors.fill: parent;
onClicked: {
fruitModel.insert(0,{
"name":"Pizza Supreme",
"cost":9.95,
"attributes":[{"description": "Cheese"},{"description": "Tomato"},{"description": "The Works"}]
- })
+ })
}
}
}
- Image { source: "content/pics/trash.png"
+ Image { source: "content/pics/archive-remove.png"
MouseRegion { anchors.fill: parent; onClicked: fruitModel.clear() }
}
}