summaryrefslogtreecommitdiffstats
path: root/examples/declarative/listview/highlight.qml
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-04-13 04:48:47 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-04-13 04:49:32 (GMT)
commit8149e7aa743c178f13452e7292ea41dccc8aec46 (patch)
tree83ed6171fc9541b328c0d223fbb55793a19fbad6 /examples/declarative/listview/highlight.qml
parent35d0792025d515e81b2bf208aa1fd7dce28096e6 (diff)
downloadQt-8149e7aa743c178f13452e7292ea41dccc8aec46.zip
Qt-8149e7aa743c178f13452e7292ea41dccc8aec46.tar.gz
Qt-8149e7aa743c178f13452e7292ea41dccc8aec46.tar.bz2
Fix code style in examples
Diffstat (limited to 'examples/declarative/listview/highlight.qml')
-rw-r--r--examples/declarative/listview/highlight.qml31
1 files changed, 14 insertions, 17 deletions
diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml
index 2b54dd8..2f7f2ca 100644
--- a/examples/declarative/listview/highlight.qml
+++ b/examples/declarative/listview/highlight.qml
@@ -1,12 +1,13 @@
import Qt 4.7
Rectangle {
- width: 400; height: 300; color: "white"
+ width: 400; height: 300
// MyPets model is defined in dummydata/MyPetsModel.qml
// The viewer automatically loads files in dummydata/* to assist
// development without a real data source.
// This one contains my pets.
+
// Define a delegate component. A component will be
// instantiated for each visible item in the list.
Component {
@@ -21,20 +22,14 @@ Rectangle {
}
// Use the ListView.isCurrentItem attached property to
// indent the item if it is the current item.
- states: [
- State {
- name: "Current"
- when: wrapper.ListView.isCurrentItem
- PropertyChanges { target: wrapper; x: 10 }
- }
- ]
- transitions: [
- Transition {
- NumberAnimation {
- properties: "x"; duration: 200
- }
- }
- ]
+ states: State {
+ name: "Current"
+ when: wrapper.ListView.isCurrentItem
+ PropertyChanges { target: wrapper; x: 10 }
+ }
+ transitions: Transition {
+ NumberAnimation { properties: "x"; duration: 200 }
+ }
}
}
// Specify a highlight with custom movement. Note that highlightFollowsCurrentItem
@@ -43,14 +38,16 @@ Rectangle {
Component {
id: petHighlight
Rectangle {
- width: 200; height: 50; color: "#FFFF88"
+ width: 200; height: 50
+ color: "#FFFF88"
SpringFollow on y { to: list1.currentItem.y; spring: 3; damping: 0.1 }
}
}
ListView {
id: list1
width: 200; height: parent.height
- model: MyPetsModel; delegate: petDelegate
+ model: MyPetsModel
+ delegate: petDelegate
highlight: petHighlight; highlightFollowsCurrentItem: false
focus: true
}