summaryrefslogtreecommitdiffstats
path: root/examples/declarative/xmldata/daringfireball.qml
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-04-30 04:54:49 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-04-30 04:54:49 (GMT)
commitf2fb6b63c6e5572d02245c64da652f13174588b9 (patch)
treeb12510b317cf9f01ecf01f9d4f082864207fc1b8 /examples/declarative/xmldata/daringfireball.qml
parent0204346fb91eaf73893b651438980cb9ca5f1f51 (diff)
downloadQt-f2fb6b63c6e5572d02245c64da652f13174588b9.zip
Qt-f2fb6b63c6e5572d02245c64da652f13174588b9.tar.gz
Qt-f2fb6b63c6e5572d02245c64da652f13174588b9.tar.bz2
Convert all examples and demos from XML format
Diffstat (limited to 'examples/declarative/xmldata/daringfireball.qml')
-rw-r--r--examples/declarative/xmldata/daringfireball.qml84
1 files changed, 59 insertions, 25 deletions
diff --git a/examples/declarative/xmldata/daringfireball.qml b/examples/declarative/xmldata/daringfireball.qml
index 5e98d1b..3877adf 100644
--- a/examples/declarative/xmldata/daringfireball.qml
+++ b/examples/declarative/xmldata/daringfireball.qml
@@ -1,25 +1,59 @@
-<Rect color="white" width="600" height="600">
- <resources>
- <XmlListModel id="feedModel" source="http://daringfireball.net/index.xml"
- query="doc($src)/feed/entry">
- <namespaceDeclarations>
- declare default element namespace 'http://www.w3.org/2005/Atom';
- </namespaceDeclarations>
- <Role name="title" query="title/string()"/>
- <Role name="tagline" query="author/name/string()"/>
- <Role name="content" query="content/string()" isCData="true"/>
- </XmlListModel>
- <Component id="feedDelegate">
- <Item height="{contents.height + 20}">
- <Text x="10" id="TitleText" text="{title}" font.bold="true"/>
- <Text text="{'by ' + tagline}" anchors.left="{TitleText.right}" anchors.leftMargin="10" font.italic="true"/>
- <Text x="10" text="{content}" anchors.top="{TitleText.bottom}" width="580" wrap="true">
- <onLinkActivated>print('link clicked: ' + link)</onLinkActivated>
- </Text>
- </Item>
- </Component>
- </resources>
-
- <ListView id="list" anchors.fill="{parent}" clip="true"
- model="{feedModel}" delegate="{feedDelegate}"/>
-</Rect>
+Rect {
+ color: "white"
+ width: 600
+ height: 600
+ resources: [
+ XmlListModel {
+ id: feedModel
+ source: "http://daringfireball.net/index.xml"
+ query: "doc($src)/feed/entry"
+ namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"
+ Role {
+ name: "title"
+ query: "title/string()"
+ }
+ Role {
+ name: "tagline"
+ query: "author/name/string()"
+ }
+ Role {
+ name: "content"
+ query: "content/string()"
+ isCData: true
+ }
+ },
+ Component {
+ id: feedDelegate
+ Item {
+ height: contents.height + 20
+ Text {
+ x: 10
+ id: TitleText
+ text: title
+ font.bold: true
+ }
+ Text {
+ text: 'by ' + tagline
+ anchors.left: TitleText.right
+ anchors.leftMargin: 10
+ font.italic: true
+ }
+ Text {
+ x: 10
+ text: content
+ anchors.top: TitleText.bottom
+ width: 580
+ wrap: true
+ onLinkActivated: { print('link clicked: ' + link) }
+ }
+ }
+ }
+ ]
+ ListView {
+ id: list
+ anchors.fill: parent
+ clip: true
+ model: feedModel
+ delegate: feedDelegate
+ }
+}