summaryrefslogtreecommitdiffstats
path: root/examples/declarative/velocity
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/velocity
parent35d0792025d515e81b2bf208aa1fd7dce28096e6 (diff)
downloadQt-8149e7aa743c178f13452e7292ea41dccc8aec46.zip
Qt-8149e7aa743c178f13452e7292ea41dccc8aec46.tar.gz
Qt-8149e7aa743c178f13452e7292ea41dccc8aec46.tar.bz2
Fix code style in examples
Diffstat (limited to 'examples/declarative/velocity')
-rw-r--r--examples/declarative/velocity/Day.qml31
-rw-r--r--examples/declarative/velocity/velocity.qml51
2 files changed, 60 insertions, 22 deletions
diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml
index a39ec94..433295b 100644
--- a/examples/declarative/velocity/Day.qml
+++ b/examples/declarative/velocity/Day.qml
@@ -18,10 +18,11 @@ Component {
Repeater {
model: notes
Item {
+ id: stickyPage
+
property int randomX: Math.random() * 500 + 100
property int randomY: Math.random() * 200 + 50
- id: stickyPage
x: randomX; y: randomY
SpringFollow on rotation {
@@ -32,26 +33,32 @@ Component {
Item {
id: sticky
scale: 0.7
+
Image {
id: stickyImage
- source: "note-yellow.png"; transformOrigin: Item.TopLeft
- smooth: true; y: -20; x: 8 + -width * 0.6 / 2; scale: 0.6
+ x: 8 + -width * 0.6 / 2; y: -20
+ source: "note-yellow.png"
+ scale: 0.6; transformOrigin: Item.TopLeft
+ smooth: true
}
TextEdit {
- id: myText; smooth: true; font.pixelSize: 24
- readOnly: false; x: -104; y: 36
- rotation: -8; text: noteText; width: 215; height: 200
+ id: myText
+ x: -104; y: 36; width: 215; height: 200
+ smooth: true
+ font.pixelSize: 24
+ readOnly: false
+ rotation: -8
+ text: noteText
}
Item {
- y: -20
- x: stickyImage.x
+ x: stickyImage.x; y: -20
width: stickyImage.width * stickyImage.scale
height: stickyImage.height * stickyImage.scale
+
MouseArea {
id: mouse
- onClicked: { myText.focus = true }
anchors.fill: parent
drag.target: stickyPage
drag.axis: "XandYAxis"
@@ -59,13 +66,15 @@ Component {
drag.maximumY: page.height - 80
drag.minimumX: 100
drag.maximumX: page.width - 140
+ onClicked: { myText.focus = true }
}
}
}
Image {
- source: "tack.png"; transformOrigin: Item.TopLeft
- x: -width / 2; y: -height * 0.5 / 2; scale: 0.7
+ x: -width / 2; y: -height * 0.5 / 2
+ source: "tack.png"
+ scale: 0.7; transformOrigin: Item.TopLeft
}
states: State {
diff --git a/examples/declarative/velocity/velocity.qml b/examples/declarative/velocity/velocity.qml
index 20821d6..871bafc 100644
--- a/examples/declarative/velocity/velocity.qml
+++ b/examples/declarative/velocity/velocity.qml
@@ -1,46 +1,75 @@
import Qt 4.7
Rectangle {
- width: 800; height: 480; color: "#464646"
+ width: 800; height: 480
+ color: "#464646"
ListModel {
id: list
+
ListElement {
name: "Sunday"
- notes: [ ListElement { noteText: "Lunch" }, ListElement { noteText: "Birthday Party" } ]
+ notes: [
+ ListElement { noteText: "Lunch" },
+ ListElement { noteText: "Birthday Party" }
+ ]
}
+
ListElement {
name: "Monday"
- notes: [ ListElement { noteText: "Pickup kids from\nschool\n4.30pm" },
- ListElement { noteText: "Checkout Qt" }, ListElement { noteText: "Read email" } ]
+ notes: [
+ ListElement { noteText: "Pickup kids from\nschool\n4.30pm" },
+ ListElement { noteText: "Checkout Qt" }, ListElement { noteText: "Read email" }
+ ]
}
+
ListElement {
name: "Tuesday"
- notes: [ ListElement { noteText: "Walk dog" }, ListElement { noteText: "Buy newspaper" } ]
+ notes: [
+ ListElement { noteText: "Walk dog" },
+ ListElement { noteText: "Buy newspaper" }
+ ]
}
+
ListElement {
- name: "Wednesday"; notes: [ ListElement { noteText: "Cook dinner" } ]
+ name: "Wednesday"
+ notes: [ ListElement { noteText: "Cook dinner" } ]
}
+
ListElement {
name: "Thursday"
- notes: [ ListElement { noteText: "Meeting\n5.30pm" }, ListElement { noteText: "Weed garden" } ]
+ notes: [
+ ListElement { noteText: "Meeting\n5.30pm" },
+ ListElement { noteText: "Weed garden" }
+ ]
}
+
ListElement {
name: "Friday"
- notes: [ ListElement { noteText: "More work" }, ListElement { noteText: "Grocery shopping" } ]
+ notes: [
+ ListElement { noteText: "More work" },
+ ListElement { noteText: "Grocery shopping" }
+ ]
}
+
ListElement {
name: "Saturday"
- notes: [ ListElement { noteText: "Drink" }, ListElement { noteText: "Download Qt\nPlay with QML" } ]
+ notes: [
+ ListElement { noteText: "Drink" },
+ ListElement { noteText: "Download Qt\nPlay with QML" }
+ ]
}
}
ListView {
id: flickable
- anchors.fill: parent; focus: true
- model: list; delegate: Day { }
+
+ anchors.fill: parent
+ focus: true
highlightRangeMode: ListView.StrictlyEnforceRange
orientation: ListView.Horizontal
snapMode: ListView.SnapOneItem
+ model: list
+ delegate: Day { }
}
}