summaryrefslogtreecommitdiff
path: root/demos/declarative/rssnews/rssnews.qml
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2010-05-17 16:45:35 +1000
committerYann Bodson <yann.bodson@nokia.com>2010-05-17 17:27:43 +1000
commit1db36a5a37dcca0e24ada3c852f2647ab2330eee (patch)
tree49bdb24dde6e2cc6bc4d5c63281498c6b757ddeb /demos/declarative/rssnews/rssnews.qml
parent9663e257f28a89f26952f5d3822a343bfe12ee6e (diff)
downloadqt4-tools-1db36a5a37dcca0e24ada3c852f2647ab2330eee.tar.gz
Move xmldata example into rssnews demo.
Diffstat (limited to 'demos/declarative/rssnews/rssnews.qml')
-rw-r--r--demos/declarative/rssnews/rssnews.qml52
1 files changed, 52 insertions, 0 deletions
diff --git a/demos/declarative/rssnews/rssnews.qml b/demos/declarative/rssnews/rssnews.qml
new file mode 100644
index 0000000000..29a530f800
--- /dev/null
+++ b/demos/declarative/rssnews/rssnews.qml
@@ -0,0 +1,52 @@
+import Qt 4.7
+import "content"
+
+Rectangle {
+ id: window
+ width: 800; height: 480
+
+ property string currentFeed: "rss.news.yahoo.com/rss/topstories"
+ property bool loading: feedModel.status == XmlListModel.Loading
+
+ RssFeeds { id: rssFeeds }
+
+ XmlListModel {
+ id: feedModel
+ source: "http://" + window.currentFeed
+ query: "/rss/channel/item"
+
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "link"; query: "link/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ }
+
+ Row {
+ Rectangle {
+ width: 220; height: window.height
+ color: "#efefef"
+
+ ListView {
+ focus: true
+ id: categories
+ anchors.fill: parent
+ model: rssFeeds
+ delegate: CategoryDelegate {}
+ highlight: Rectangle { color: "steelblue" }
+ highlightMoveSpeed: 9999999
+ }
+ ScrollBar {
+ scrollArea: categories; height: categories.height; width: 8
+ anchors.right: categories.right
+ }
+ }
+ ListView {
+ id: list
+ width: window.width - 220; height: window.height
+ model: feedModel
+ delegate: NewsDelegate {}
+ }
+ }
+
+ ScrollBar { scrollArea: list; height: list.height; width: 8; anchors.right: window.right }
+ Rectangle { x: 220; height: window.height; width: 1; color: "#cccccc" }
+}