summaryrefslogtreecommitdiffstats
path: root/examples/declarative/xml
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-17 05:15:57 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-17 05:15:57 (GMT)
commitf60eeb5c165d5b9e5998edae7785cc893a613bca (patch)
tree13997c6ce889b1e51dd159c016437503a094a7e5 /examples/declarative/xml
parentbdbe09ad2c01ae11d10511b51f8d7a3dfb27b17c (diff)
parent7a738662838763e4828c6ac8957a2823b095f566 (diff)
downloadQt-f60eeb5c165d5b9e5998edae7785cc893a613bca.zip
Qt-f60eeb5c165d5b9e5998edae7785cc893a613bca.tar.gz
Qt-f60eeb5c165d5b9e5998edae7785cc893a613bca.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Focus should be applied to focus scopes all the way up the chain, not Add focus docs snippets Fix doc for status, add Image::onLoaded. Don't crash due to recursive positioning. ListModel::get() shouldn't print warnings for invalid indices since it Add \brief to TextInput Add missing .pro Restructure the examples. They are now organized into various graphicsWidgets doc example was previously removed Doc fix Add a "priority" property to Keys and KeyNavigation
Diffstat (limited to 'examples/declarative/xml')
-rw-r--r--examples/declarative/xml/xml.qmlproject16
-rw-r--r--examples/declarative/xml/xmldata/daringfireball.qml47
-rw-r--r--examples/declarative/xml/xmldata/xmldata.qmlproject16
-rw-r--r--examples/declarative/xml/xmldata/yahoonews.qml83
-rw-r--r--examples/declarative/xml/xmlhttprequest/test.qml36
-rw-r--r--examples/declarative/xml/xmlhttprequest/test.xml5
-rw-r--r--examples/declarative/xml/xmlhttprequest/xmlhttprequest.qmlproject16
7 files changed, 219 insertions, 0 deletions
diff --git a/examples/declarative/xml/xml.qmlproject b/examples/declarative/xml/xml.qmlproject
new file mode 100644
index 0000000..d4909f8
--- /dev/null
+++ b/examples/declarative/xml/xml.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.0
+
+Project {
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ /* List of plugin directories passed to QML runtime */
+ // importPaths: [ " ../exampleplugin " ]
+}
diff --git a/examples/declarative/xml/xmldata/daringfireball.qml b/examples/declarative/xml/xmldata/daringfireball.qml
new file mode 100644
index 0000000..480b13c
--- /dev/null
+++ b/examples/declarative/xml/xmldata/daringfireball.qml
@@ -0,0 +1,47 @@
+import Qt 4.7
+
+Rectangle {
+ width: 600; height: 600
+
+ XmlListModel {
+ id: feedModel
+ source: "http://daringfireball.net/index.xml"
+ query: "/feed/entry"
+ namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "tagline"; query: "author/name/string()" }
+ XmlRole { name: "content"; query: "content/string()" }
+ }
+
+ Component {
+ id: feedDelegate
+ Item {
+ height: childrenRect.height + 20
+ Text {
+ id: titleText
+ x: 10
+ text: title; font.bold: true
+ }
+ Text {
+ anchors { left: titleText.right; leftMargin: 10 }
+ text: 'by ' + tagline
+ font.italic: true
+ }
+ Text {
+ x: 10
+ width: 580
+ anchors.top: titleText.bottom
+ text: content
+ wrapMode: Text.WordWrap
+
+ onLinkActivated: { console.log('link clicked: ' + link) }
+ }
+ }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: feedModel
+ delegate: feedDelegate
+ }
+}
diff --git a/examples/declarative/xml/xmldata/xmldata.qmlproject b/examples/declarative/xml/xmldata/xmldata.qmlproject
new file mode 100644
index 0000000..d4909f8
--- /dev/null
+++ b/examples/declarative/xml/xmldata/xmldata.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.0
+
+Project {
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ /* List of plugin directories passed to QML runtime */
+ // importPaths: [ " ../exampleplugin " ]
+}
diff --git a/examples/declarative/xml/xmldata/yahoonews.qml b/examples/declarative/xml/xmldata/yahoonews.qml
new file mode 100644
index 0000000..5bab463
--- /dev/null
+++ b/examples/declarative/xml/xmldata/yahoonews.qml
@@ -0,0 +1,83 @@
+import Qt 4.7
+
+Rectangle {
+ width: 600; height: 600
+
+ gradient: Gradient {
+ GradientStop { position: 0; color: "black" }
+ GradientStop { position: 1.0; color: "#AAAAAA" }
+ }
+
+ XmlListModel {
+ id: feedModel
+ source: "http://rss.news.yahoo.com/rss/oceania"
+ query: "/rss/channel/item"
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "link"; query: "link/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ }
+
+ Component {
+ id: feedDelegate
+
+ Item {
+ id: delegate
+ height: wrapper.height + 10
+
+ MouseArea {
+ anchors.fill: wrapper
+ onPressed: delegate.ListView.view.currentIndex = index;
+ onClicked: if (wrapper.state == 'Details') wrapper.state = ''; else wrapper.state = 'Details';
+ }
+
+ Rectangle {
+ id: wrapper
+
+ width: 580; y: 5; height: titleText.height + 10
+ color: "#F0F0F0"
+ radius: 5
+
+ Text {
+ id: titleText
+ x: 10; y: 5
+ text: '<a href=\'' + link + '\'>' + title + '</a>'
+ font { bold: true; family: "Helvetica"; pointSize: 14 }
+
+ onLinkActivated: { console.log('link clicked: ' + link) }
+ }
+
+ Text {
+ id: descriptionText
+ x: 10; width: 560
+ anchors.top: titleText.bottom; anchors.topMargin: 5
+ text: description
+ wrapMode: Text.WordWrap
+ font.family: "Helvetica"
+ opacity: 0
+ }
+
+ states: State {
+ name: "Details"
+ PropertyChanges { target: wrapper; height: childrenRect.height + 10 }
+ PropertyChanges { target: descriptionText; opacity: 1 }
+ }
+
+ transitions: Transition {
+ from: "*"; to: "Details"; reversible: true
+ SequentialAnimation {
+ NumberAnimation { duration: 200; properties: "height"; easing.type: Easing.OutQuad }
+ NumberAnimation { duration: 200; properties: "opacity" }
+ }
+ }
+ }
+ }
+ }
+
+ ListView {
+ id: list
+ x: 10; y: 10
+ width: parent.width - 20; height: parent.height - 20
+ model: feedModel
+ delegate: feedDelegate
+ }
+}
diff --git a/examples/declarative/xml/xmlhttprequest/test.qml b/examples/declarative/xml/xmlhttprequest/test.qml
new file mode 100644
index 0000000..c7e7e6d
--- /dev/null
+++ b/examples/declarative/xml/xmlhttprequest/test.qml
@@ -0,0 +1,36 @@
+import Qt 4.7
+
+Rectangle {
+ width: 800; height: 600
+
+ MouseArea {
+ anchors.fill: parent
+
+ onClicked: {
+ var doc = new XMLHttpRequest();
+ doc.onreadystatechange = function() {
+ if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
+ console.log("Headers -->");
+ console.log(doc.getAllResponseHeaders ());
+ console.log("Last modified -->");
+ console.log(doc.getResponseHeader ("Last-Modified"));
+ }
+ else if (doc.readyState == XMLHttpRequest.DONE) {
+
+ var a = doc.responseXML.documentElement;
+ for (var ii = 0; ii < a.childNodes.length; ++ii) {
+ console.log(a.childNodes[ii].nodeName);
+ }
+ console.log("Headers -->");
+ console.log(doc.getAllResponseHeaders ());
+ console.log("Last modified -->");
+ console.log(doc.getResponseHeader ("Last-Modified"));
+
+ }
+ }
+
+ doc.open("GET", "test.xml");
+ doc.send();
+ }
+ }
+}
diff --git a/examples/declarative/xml/xmlhttprequest/test.xml b/examples/declarative/xml/xmlhttprequest/test.xml
new file mode 100644
index 0000000..8b7f1e1
--- /dev/null
+++ b/examples/declarative/xml/xmlhttprequest/test.xml
@@ -0,0 +1,5 @@
+<data>
+ <element1 />
+ <element2 />
+</data>
+
diff --git a/examples/declarative/xml/xmlhttprequest/xmlhttprequest.qmlproject b/examples/declarative/xml/xmlhttprequest/xmlhttprequest.qmlproject
new file mode 100644
index 0000000..d4909f8
--- /dev/null
+++ b/examples/declarative/xml/xmlhttprequest/xmlhttprequest.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.0
+
+Project {
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ /* List of plugin directories passed to QML runtime */
+ // importPaths: [ " ../exampleplugin " ]
+}