summaryrefslogtreecommitdiffstats
path: root/examples/declarative/contacts/contacts.qml
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-04-29 04:33:52 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-04-29 04:33:52 (GMT)
commite79ce618a079c7f1664959da5d9d13b5f4e1d370 (patch)
treedabf9efe361c27cec4377de04e1a24ae3eca03fb /examples/declarative/contacts/contacts.qml
parentf49f040660fd004ea6289cdc3a92a7ad42338237 (diff)
parent9ba03ca32ae12f8b135f3b4f80c445edc3e6b55e (diff)
downloadQt-e79ce618a079c7f1664959da5d9d13b5f4e1d370.zip
Qt-e79ce618a079c7f1664959da5d9d13b5f4e1d370.tar.gz
Qt-e79ce618a079c7f1664959da5d9d13b5f4e1d370.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples/declarative/contacts/contacts.qml')
-rw-r--r--examples/declarative/contacts/contacts.qml165
1 files changed, 121 insertions, 44 deletions
diff --git a/examples/declarative/contacts/contacts.qml b/examples/declarative/contacts/contacts.qml
index d4647f9..fa50010 100644
--- a/examples/declarative/contacts/contacts.qml
+++ b/examples/declarative/contacts/contacts.qml
@@ -1,44 +1,121 @@
-<Rect id="page" width="320" height="480" color="white">
- <resources>
- <Component id="contactDelegate">
- <Rect id="wrapper" x="20" width="{List.width-40}" color="#FEFFEE" pen.color="#FFBE4F" radius="5">
- <filter><Shadow xOffset="5" yOffset="5" /></filter>
- <MouseRegion id="pageMouse" anchors.fill="{parent}" onClicked="if (wrapper.state == 'Details') { wrapper.state = '';} else {wrapper.state = 'Details';}"/>
- <Image id="portraitPic" src="{portrait}" x="10" y="10" />
- <Text id="name" text="{firstName + ' ' + lastName}" anchors.left="{portraitPic.right}" anchors.leftMargin="10"
- anchors.top="{portraitPic.top}" anchors.right="{wrapper.right}" anchors.rightMargin="10"
- font.family="Comic Sans MS" font.bold="true" font.size="11"/>
- <VerticalLayout id="email_layout" anchors.left="{name.left}" anchors.top="{name.bottom}" anchors.topMargin="10">
- <Repeater id="email_list" dataSource="{emails}" >
- <Component>
- <Text text="{modelData}" height="18" font.italic="true" color="midnightblue" />
- </Component>
- </Repeater>
- </VerticalLayout>
- <height>{Math.max(email_layout.height + name.height + 25, portraitPic.height+20)}</height>
-
- <states>
- <State name="Details">
- <SetProperty target="{wrapper}" property="color" value="white" />
- <SetProperty target="{wrapper}" property="x" value="0" />
- <SetProperty target="{wrapper}" property="height" value="{List.height}" />
- <SetProperty target="{wrapper}" property="width" value="{List.width}" />
- <SetProperty target="{wrapper.ListView.view}" property="yPosition" value="{wrapper.y}"/>
- <SetProperty target="{wrapper.ListView.view}" property="locked" value="1"/>
- </State>
- </states>
-
- <transitions>
- <Transition>
- <ParallelAnimation>
- <ColorAnimation duration="500" />
- <NumericAnimation duration="150" properties="x,yPosition,height,width"/>
- </ParallelAnimation>
- </Transition>
- </transitions>
- </Rect>
- </Component>
- </resources>
-
- <ListView id="List" model="{contactModel}" width="320" height="480" clip="true" delegate="{contactDelegate}"/>
-</Rect>
+Rect {
+ id: page
+ width: 320
+ height: 480
+ color: "white"
+ resources: [
+ Component {
+ id: contactDelegate
+ Rect {
+ id: wrapper
+ x: 20
+ width: List.width-40
+ color: "#FEFFEE"
+ pen.color: "#FFBE4F"
+ radius: 5
+ filter: Shadow {
+ xOffset: 5
+ yOffset: 5
+ }
+ MouseRegion {
+ id: pageMouse
+ anchors.fill: parent
+ onClicked: { if (wrapper.state == 'Details') { wrapper.state = '';} else {wrapper.state = 'Details';} }
+ }
+ Image {
+ id: portraitPic
+ src: portrait
+ x: 10
+ y: 10
+ }
+ Text {
+ id: name
+ text: firstName + ' ' + lastName
+ anchors.left: portraitPic.right
+ anchors.leftMargin: 10
+ anchors.top: portraitPic.top
+ anchors.right: wrapper.right
+ anchors.rightMargin: 10
+ font.family: "Comic Sans MS"
+ font.bold: true
+ font.size: 11
+ }
+ VerticalLayout {
+ id: email_layout
+ anchors.left: name.left
+ anchors.top: name.bottom
+ anchors.topMargin: 10
+ Repeater {
+ id: email_list
+ dataSource: emails
+ Component {
+ Text {
+ text: modelData
+ height: 18
+ font.italic: true
+ color: "midnightblue"
+ }
+ }
+ }
+ }
+ height: Math.max(email_layout.height + name.height + 25, portraitPic.height+20)
+ states: [
+ State {
+ name: "Details"
+ SetProperty {
+ target: wrapper
+ property: "color"
+ value: "white"
+ }
+ SetProperty {
+ target: wrapper
+ property: "x"
+ value: 0
+ }
+ SetProperty {
+ target: wrapper
+ property: "height"
+ value: List.height
+ }
+ SetProperty {
+ target: wrapper
+ property: "width"
+ value: List.width
+ }
+ SetProperty {
+ target: wrapper.ListView.view
+ property: "yPosition"
+ value: wrapper.y
+ }
+ SetProperty {
+ target: wrapper.ListView.view
+ property: "locked"
+ value: 1
+ }
+ }
+ ]
+ transitions: [
+ Transition {
+ ParallelAnimation {
+ ColorAnimation {
+ duration: 500
+ }
+ NumericAnimation {
+ duration: 150
+ properties: "x,yPosition,height,width"
+ }
+ }
+ }
+ ]
+ }
+ }
+ ]
+ ListView {
+ id: List
+ model: contactModel
+ width: 320
+ height: 480
+ clip: true
+ delegate: contactDelegate
+ }
+}