summaryrefslogtreecommitdiffstats
path: root/examples/declarative/listview
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-10-06 04:05:40 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-10-06 04:05:40 (GMT)
commit43199af242918b3c77bb47bdcc3ec60f8236b0d3 (patch)
tree94293b06614afbd3a2a89004204a23e7228a3d51 /examples/declarative/listview
parentb9663faad39ae02b7dbee9f2cea7dce7d25894f8 (diff)
downloadQt-43199af242918b3c77bb47bdcc3ec60f8236b0d3.zip
Qt-43199af242918b3c77bb47bdcc3ec60f8236b0d3.tar.gz
Qt-43199af242918b3c77bb47bdcc3ec60f8236b0d3.tar.bz2
lowercase ids
Diffstat (limited to 'examples/declarative/listview')
-rw-r--r--examples/declarative/listview/content/ClickAutoRepeating.qml17
-rw-r--r--examples/declarative/listview/content/MediaButton.qml34
-rw-r--r--examples/declarative/listview/dynamic.qml42
-rw-r--r--examples/declarative/listview/highlight.qml18
-rw-r--r--examples/declarative/listview/itemlist.qml20
-rw-r--r--examples/declarative/listview/listview.qml23
-rw-r--r--examples/declarative/listview/recipes.qml6
-rw-r--r--examples/declarative/listview/sections.qml28
8 files changed, 91 insertions, 97 deletions
diff --git a/examples/declarative/listview/content/ClickAutoRepeating.qml b/examples/declarative/listview/content/ClickAutoRepeating.qml
index 19dd6f6..f0e7df1 100644
--- a/examples/declarative/listview/content/ClickAutoRepeating.qml
+++ b/examples/declarative/listview/content/ClickAutoRepeating.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Item {
- id: Page
+ id: page
property int repeatdelay: 300
property int repeatperiod: 75
property bool pressed: false
@@ -9,21 +9,20 @@ Item {
signal released
signal clicked
pressed: SequentialAnimation {
- id: AutoRepeat
- PropertyAction { target: Page; property: "pressed"; value: true }
- ScriptAction { script: Page.onPressed }
- ScriptAction { script: Page.onClicked }
+ id: autoRepeat
+ PropertyAction { target: page; property: "pressed"; value: true }
+ ScriptAction { script: page.onPressed }
+ ScriptAction { script: page.onClicked }
PauseAnimation { duration: repeatdelay }
SequentialAnimation {
repeat: true
- ScriptAction { script: Page.onClicked }
+ ScriptAction { script: page.onClicked }
PauseAnimation { duration: repeatperiod }
}
}
MouseRegion {
- id: MR
anchors.fill: parent
- onPressed: AutoRepeat.start()
- onReleased: { AutoRepeat.stop(); parent.pressed = false; Page.released }
+ onPressed: autoRepeat.start()
+ onReleased: { autoRepeat.stop(); parent.pressed = false; page.released }
}
}
diff --git a/examples/declarative/listview/content/MediaButton.qml b/examples/declarative/listview/content/MediaButton.qml
index 3b0ef1e..1c88844 100644
--- a/examples/declarative/listview/content/MediaButton.qml
+++ b/examples/declarative/listview/content/MediaButton.qml
@@ -4,36 +4,32 @@ Item {
property var text
signal clicked
- id: Container
+ id: container
Image {
- id: Normal
+ id: normal
source: "pics/button.png"
}
Image {
- id: Pressed
+ id: pressed
source: "pics/button-pressed.png"
opacity: 0
}
MouseRegion {
- id: ClickRegion
- anchors.fill: Normal
- onClicked: { Container.clicked(); }
+ id: clickRegion
+ anchors.fill: normal
+ onClicked: { container.clicked(); }
}
Text {
font.bold: true
color: "white"
- anchors.centerIn: Normal
- text: Container.text
+ anchors.centerIn: normal
+ text: container.text
+ }
+ width: normal.width
+
+ states: State {
+ name: "Pressed"
+ when: clickRegion.pressed == true
+ PropertyChanges { target: pressed; opacity: 1 }
}
- width: Normal.width
- states: [
- State {
- name: "Pressed"
- when: ClickRegion.pressed == true
- PropertyChanges {
- target: Pressed
- opacity: 1
- }
- }
- ]
}
diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml
index 52c3c0b..4f8e483 100644
--- a/examples/declarative/listview/dynamic.qml
+++ b/examples/declarative/listview/dynamic.qml
@@ -6,7 +6,7 @@ Item {
height: 500
ListModel {
- id: FruitModel
+ id: fruitModel
ListElement {
name: "Apple"
cost: 2.45
@@ -56,13 +56,13 @@ Item {
}
Component {
- id: FruitDelegate
+ id: fruitDelegate
Item {
width: parent.width; height: 55
- Text { id: Label; font.pixelSize: 24; text: name; elide: "ElideRight"; anchors.right: Cost.left; anchors.left:parent.left }
- Text { id: Cost; font.pixelSize: 24; text: '$'+Number(cost).toFixed(2); anchors.right: ItemButtons.left }
- Row {
- anchors.top: Label.bottom
+ Text { id: label; font.pixelSize: 24; text: name; elide: "ElideRight"; anchors.right: cost.left; anchors.left:parent.left }
+ Text { id: cost; font.pixelSize: 24; text: '$'+Number(cost).toFixed(2); anchors.right: itemButtons.left }
+ Row {
+ anchors.top: label.bottom
spacing: 5
Repeater {
model: attributes
@@ -72,27 +72,27 @@ Item {
}
}
Row {
- id: ItemButtons
+ id: itemButtons
anchors.right: parent.right
width: childrenRect.width
Image { source: "content/pics/add.png"
- ClickAutoRepeating { id: ClickUp; anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Number(cost)+0.25) }
- scale: ClickUp.pressed ? 0.9 : 1
+ ClickAutoRepeating { id: clickUp; anchors.fill: parent; onClicked: fruitModel.set(index,"cost",Number(cost)+0.25) }
+ scale: clickUp.pressed ? 0.9 : 1
}
Image { source: "content/pics/del.png"
- ClickAutoRepeating { id: ClickDown; anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Math.max(0,Number(cost)-0.25)) }
- scale: ClickDown.pressed ? 0.9 : 1
+ ClickAutoRepeating { id: clickDown; anchors.fill: parent; onClicked: fruitModel.set(index,"cost",Math.max(0,Number(cost)-0.25)) }
+ scale: clickDown.pressed ? 0.9 : 1
}
Image { source: "content/pics/trash.png"
- MouseRegion { anchors.fill: parent; onClicked: FruitModel.remove(index) }
+ 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) }
+ 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) }
+ MouseRegion { anchors.fill: parent; onClicked: fruitModel.move(index,index+1,1) }
}
}
}
@@ -100,23 +100,23 @@ Item {
}
ListView {
- model: FruitModel
- delegate: FruitDelegate
+ model: fruitModel
+ delegate: fruitDelegate
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
- anchors.bottom: Buttons.top
+ anchors.bottom: buttons.top
}
Row {
width: childrenRect.width
height: childrenRect.height
anchors.bottom: parent.bottom
- id: Buttons
+ id: buttons
Image { source: "content/pics/add.png"
MouseRegion { anchors.fill: parent;
onClicked: {
- FruitModel.append({
+ fruitModel.append({
"name":"Pizza Margarita",
"cost":5.95,
"attributes":[{"description": "Cheese"},{"description": "Tomato"}]
@@ -127,7 +127,7 @@ Item {
Image { source: "content/pics/add.png"
MouseRegion { anchors.fill: parent;
onClicked: {
- FruitModel.insert(0,{
+ fruitModel.insert(0,{
"name":"Pizza Supreme",
"cost":9.95,
"attributes":[{"description": "Cheese"},{"description": "Tomato"},{"description": "The Works"}]
@@ -136,7 +136,7 @@ Item {
}
}
Image { source: "content/pics/trash.png"
- MouseRegion { anchors.fill: parent; onClicked: FruitModel.clear() }
+ MouseRegion { anchors.fill: parent; onClicked: fruitModel.clear() }
}
}
}
diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml
index b6db453..be1f62d 100644
--- a/examples/declarative/listview/highlight.qml
+++ b/examples/declarative/listview/highlight.qml
@@ -10,9 +10,9 @@ Rectangle {
// Define a delegate component. A component will be
// instantiated for each visible item in the list.
Component {
- id: PetDelegate
+ id: petDelegate
Item {
- id: Wrapper
+ id: wrapper
width: 200; height: 50
Column {
Text { text: 'Name: ' + name }
@@ -24,8 +24,8 @@ Rectangle {
states: [
State {
name: "Current"
- when: Wrapper.ListView.isCurrentItem
- PropertyChanges { target: Wrapper; x: 10 }
+ when: wrapper.ListView.isCurrentItem
+ PropertyChanges { target: wrapper; x: 10 }
}
]
transitions: [
@@ -41,17 +41,17 @@ Rectangle {
// is set to false in the ListView so that we can control how the
// highlight moves to the current item.
Component {
- id: PetHighlight
+ id: petHighlight
Rectangle {
width: 200; height: 50; color: "#FFFF88"
- y: SpringFollow { source: List1.currentItem.y; spring: 3; damping: 0.1 }
+ y: SpringFollow { source: list1.currentItem.y; spring: 3; damping: 0.1 }
}
}
ListView {
- id: List1
+ id: list1
width: 200; height: parent.height
- model: MyPetsModel; delegate: PetDelegate
- highlight: PetHighlight; highlightFollowsCurrentItem: false
+ model: MyPetsModel; delegate: petDelegate
+ highlight: petHighlight; highlightFollowsCurrentItem: false
focus: true
}
}
diff --git a/examples/declarative/listview/itemlist.qml b/examples/declarative/listview/itemlist.qml
index 01781ec..6dfc90b 100644
--- a/examples/declarative/listview/itemlist.qml
+++ b/examples/declarative/listview/itemlist.qml
@@ -9,26 +9,26 @@ Rectangle {
height: 320
VisualItemModel {
- id: ItemModel
+ id: itemModel
Rectangle {
- height: View.height; width: View.width; color: "#FFFEF0"
+ height: view.height; width: view.width; color: "#FFFEF0"
Text { text: "Page 1"; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
- height: View.height; width: View.width; color: "#F0FFF7"
+ height: view.height; width: view.width; color: "#F0FFF7"
Text { text: "Page 2"; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
- height: View.height; width: View.width; color: "#F4F0FF"
+ height: view.height; width: view.width; color: "#F4F0FF"
Text { text: "Page 3"; font.bold: true; anchors.centerIn: parent }
}
}
ListView {
- id: View
+ id: view
anchors.fill: parent
anchors.bottomMargin: 30
- model: ItemModel
+ model: itemModel
preferredHighlightBegin: 0
preferredHighlightEnd: 1
strictlyEnforceHighlightRange: true
@@ -37,7 +37,7 @@ Rectangle {
Rectangle {
color: "gray"
- anchors.top: View.bottom
+ anchors.top: view.bottom
anchors.bottom: parent.bottom
height: 30
width: 240
@@ -46,12 +46,12 @@ Rectangle {
anchors.centerIn: parent
spacing: 20
Repeater {
- model: ItemModel.count
+ model: itemModel.count
Rectangle {
width: 5; height: 5
radius: 3
- MouseRegion { width: 20; height: 20; anchors.centerIn: parent; onClicked: View.currentIndex = index }
- color: View.currentIndex == index ? "blue" : "white"
+ MouseRegion { width: 20; height: 20; anchors.centerIn: parent; onClicked: view.currentIndex = index }
+ color: view.currentIndex == index ? "blue" : "white"
}
}
}
diff --git a/examples/declarative/listview/listview.qml b/examples/declarative/listview/listview.qml
index ac1cef1..98974fd 100644
--- a/examples/declarative/listview/listview.qml
+++ b/examples/declarative/listview/listview.qml
@@ -10,9 +10,8 @@ Rectangle {
// Define a delegate component. A component will be
// instantiated for each visible item in the list.
Component {
- id: PetDelegate
+ id: petDelegate
Item {
- id: Wrapper
width: 200; height: 50
Column {
Text { text: 'Name: ' + name }
@@ -25,7 +24,7 @@ Rectangle {
// Define a highlight component. Just one of these will be instantiated
// by each ListView and placed behind the current item.
Component {
- id: PetHighlight
+ id: petHighlight
Rectangle { color: "#FFFF88" }
}
@@ -50,25 +49,25 @@ Rectangle {
// the third ListView's currentIndex. By flicking List3 with
// the mouse, the current index of List1 will be changed.
ListView {
- id: List1
+ id: list1
width: 200; height: parent.height
- model: MyPetsModel; delegate: PetDelegate
- highlight: PetHighlight; currentIndex: List3.currentIndex
+ model: MyPetsModel; delegate: petDelegate
+ highlight: petHighlight; currentIndex: list3.currentIndex
focus: true
}
ListView {
- id: List2
+ id: list2
x: 200; width: 200; height: parent.height
- model: MyPetsModel; delegate: PetDelegate; highlight: PetHighlight
+ model: MyPetsModel; delegate: petDelegate; highlight: petHighlight
preferredHighlightBegin: 80
preferredHighlightEnd: 220
- currentIndex: List1.currentIndex
+ currentIndex: list1.currentIndex
}
ListView {
- id: List3
+ id: list3
x: 400; width: 200; height: parent.height
- model: MyPetsModel; delegate: PetDelegate; highlight: PetHighlight
- currentIndex: List1.currentIndex
+ model: MyPetsModel; delegate: petDelegate; highlight: petHighlight
+ currentIndex: list1.currentIndex
preferredHighlightBegin: 125
preferredHighlightEnd: 126
strictlyEnforceHighlightRange: true
diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml
index 2148ef4..4ccb344 100644
--- a/examples/declarative/listview/recipes.qml
+++ b/examples/declarative/listview/recipes.qml
@@ -13,7 +13,7 @@ Rectangle {
id: recipeDelegate
Item {
id: wrapper
- width: List.width
+ width: list.width
// Create a property to contain the visibility of the details.
// We can bind multiple element's opacity to this one property,
// rather than having a "PropertyChanges" line for each element we
@@ -102,7 +102,7 @@ Rectangle {
// Make details visible
PropertyChanges { target: wrapper; detailsOpacity: 1; x: 0 }
// Make the detailed view fill the entire list area
- PropertyChanges { target: wrapper; height: List.height }
+ PropertyChanges { target: wrapper; height: list.height }
// Move the list so that this item is at the top.
PropertyChanges { target: wrapper.ListView.view; explicit: true; viewportY: wrapper.y }
// Disallow flicking while we're in detailed view
@@ -125,7 +125,7 @@ Rectangle {
]
// The actual list
ListView {
- id: List
+ id: list
model: Recipes; delegate: recipeDelegate
anchors.fill: parent; clip: true
}
diff --git a/examples/declarative/listview/sections.qml b/examples/declarative/listview/sections.qml
index ddb4931..6b1a589 100644
--- a/examples/declarative/listview/sections.qml
+++ b/examples/declarative/listview/sections.qml
@@ -12,32 +12,32 @@ Rectangle {
// Define a delegate component that includes a separator for sections.
Component {
- id: PetDelegate
+ id: petDelegate
Item {
- id: Wrapper
+ id: wrapper
width: 200
// My height is the combined height of the description and the section separator
- height: Separator.height + Desc.height
+ height: separator.height + desc.height
Rectangle {
- id: Separator
+ id: separator
color: "lightsteelblue"
width: parent.width
// Only show the section separator when we are the beginning of a new section
// Note that for this to work nicely, the list must be ordered by section.
- height: Wrapper.ListView.prevSection != Wrapper.ListView.section ? 20 : 0
- opacity: Wrapper.ListView.prevSection != Wrapper.ListView.section ? 1 : 0
+ height: wrapper.ListView.prevSection != wrapper.ListView.section ? 20 : 0
+ opacity: wrapper.ListView.prevSection != wrapper.ListView.section ? 1 : 0
Text {
- text: Wrapper.ListView.section; font.bold: true
+ text: wrapper.ListView.section; font.bold: true
x: 2; height: parent.height; verticalAlignment: 'AlignVCenter'
}
}
Item {
- id: Desc
+ id: desc
x: 5
- height: Layout.height + 4
- anchors.top: Separator.bottom
+ height: layout.height + 4
+ anchors.top: separator.bottom
Column {
- id: Layout
+ id: layout
y: 2
Text { text: 'Name: ' + name }
Text { text: 'Type: ' + type }
@@ -49,7 +49,7 @@ Rectangle {
// Define a highlight component. Just one of these will be instantiated
// by each ListView and placed behind the current item.
Component {
- id: PetHighlight
+ id: petHighlight
Rectangle {
color: "#FFFF88"
}
@@ -60,8 +60,8 @@ Rectangle {
width: 200
height: parent.height
model: MyPetsModel
- delegate: PetDelegate
- highlight: PetHighlight
+ delegate: petDelegate
+ highlight: petHighlight
// The sectionExpression is simply the size of the pet.
// We use this to determine which section we are in above.
sectionExpression: "size"