summaryrefslogtreecommitdiffstats
path: root/examples/declarative/xmldata/yahoonews.qml
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-04-22 04:47:24 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-04-22 04:47:24 (GMT)
commit2366667fc97eb6a56203b2dd7dac776ff4164abd (patch)
treeb2acb6cc6bfe475d7e619e4788973b61fff775e0 /examples/declarative/xmldata/yahoonews.qml
parent2c762f3b8b284a7c6dc0c499b7052013bad5b707 (diff)
downloadQt-2366667fc97eb6a56203b2dd7dac776ff4164abd.zip
Qt-2366667fc97eb6a56203b2dd7dac776ff4164abd.tar.gz
Qt-2366667fc97eb6a56203b2dd7dac776ff4164abd.tar.bz2
Initial import of kinetic-dui branch from the old kinetic
Diffstat (limited to 'examples/declarative/xmldata/yahoonews.qml')
-rw-r--r--examples/declarative/xmldata/yahoonews.qml38
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml
new file mode 100644
index 0000000..80ace18
--- /dev/null
+++ b/examples/declarative/xmldata/yahoonews.qml
@@ -0,0 +1,38 @@
+<Rect color="black" gradientColor="#AAAAAA" width="600" height="600">
+ <resources>
+ <XmlListModel id="feedModel" src="http://rss.news.yahoo.com/rss/oceania" query="doc($src)/rss/channel/item">
+ <Role name="title" query="title/string()"/>
+ <Role name="link" query="link/string()"/>
+ <Role name="description" query="description/string()" isCData="true"/>
+ </XmlListModel>
+ <Component id="feedDelegate">
+ <Item id="Delegate" height="{Wrapper.height + 10}">
+ <MouseRegion anchors.fill="{Wrapper}" onPressed="Delegate.ListView.list.currentIndex = index;"
+ onClicked="if (Wrapper.state == 'Details') { Wrapper.state = '';} else {Wrapper.state = 'Details';}"/>
+ <Rect id="Wrapper" y="5" height="{TitleText.height + 10}" width="580" color="#F0F0F0" radius="5">
+ <Text x="10" y="5" id="TitleText" text="{'&lt;a href=\'' + link + '\'&gt;' + title + '&lt;/a&gt;'}" font.bold="true" font.family="Helvetica" font.size="14" onLinkActivated="print('link clicked: ' + link)"/>
+ <Text x="10" id="Description" text="{description}" width="560" wrap="true" font.family="Helvetica"
+ anchors.top="{TitleText.bottom}" anchors.topMargin="5" opacity="0"/>
+
+ <states>
+ <State name="Details">
+ <SetProperty target="{Wrapper}" property="height" binding="contents.height + 10"/>
+ <SetProperty target="{Description}" property="opacity" value="1"/>
+ </State>
+ </states>
+ <transitions>
+ <Transition fromState="*" toState="Details" reversible="true">
+ <SequentialAnimation>
+ <NumericAnimation duration="200" properties="height" easing="easeOutQuad"/>
+ <NumericAnimation duration="200" properties="opacity"/>
+ </SequentialAnimation>
+ </Transition>
+ </transitions>
+ </Rect>
+ </Item>
+ </Component>
+ </resources>
+
+ <ListView id="list" x="10" y="10" width="{parent.width - 20}" height="{parent.height - 20}" clip="true"
+ model="{feedModel}" delegate="{feedDelegate}" currentItemPositioning="Snap"/>
+</Rect>