diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-04-13 14:48:47 +1000 |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-04-13 14:49:32 +1000 |
commit | 8149e7aa743c178f13452e7292ea41dccc8aec46 (patch) | |
tree | 83ed6171fc9541b328c0d223fbb55793a19fbad6 /examples/declarative/velocity | |
parent | 35d0792025d515e81b2bf208aa1fd7dce28096e6 (diff) | |
download | qt4-tools-8149e7aa743c178f13452e7292ea41dccc8aec46.tar.gz |
Fix code style in examples
Diffstat (limited to 'examples/declarative/velocity')
-rw-r--r-- | examples/declarative/velocity/Day.qml | 31 | ||||
-rw-r--r-- | examples/declarative/velocity/velocity.qml | 51 |
2 files changed, 60 insertions, 22 deletions
diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index a39ec9453d..433295b88c 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 20821d6df6..871bafc488 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 { } } } |