Doc: Reintroduce missing sample XML file for XMLRole documentation
authorTopi Reinio <topi.reinio@digia.com>
Mon, 17 Mar 2014 08:37:31 +0000 (09:37 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 18 Mar 2014 11:00:58 +0000 (12:00 +0100)
XMLRole documentation talks about sample XML content, but
erraenously quoted a QML file instead.

This change brings back the sample file from Qt 4.8, and
updates it to cover the use of boolean role.

Change-Id: Id71550fab15c761320551f6583a138cd7cc88376
Reviewed-by: Bea Lam <bea.lam@jollamobile.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
src/imports/xmllistmodel/qqmlxmllistmodel.cpp
src/quick/doc/snippets/qml/xmlrole.qml
src/quick/doc/snippets/qml/xmlrole.xml [new file with mode: 0644]

index 0b9be3105bc6e2d5ba636f23c6b7cdbb1b5f3fa8..3c6967fd69c6874d40adc0b8fa990e88dd75f866 100644 (file)
@@ -132,13 +132,17 @@ typedef QPair<int, int> QQuickXmlListRange;
 
     For example, if there is an XML document like this:
 
-    \quotefile qml/xmlrole.qml
+    \quotefile qml/xmlrole.xml
     Here are some valid XPath expressions for XmlRole queries on this document:
 
     \snippet qml/xmlrole.qml 0
     \dots 4
     \snippet qml/xmlrole.qml 1
 
+    Accessing the model data for the above roles from a delegate:
+
+    \snippet qml/xmlrole.qml 2
+
     See the \l{http://www.w3.org/TR/xpath20/}{W3C XPath 2.0 specification} for more information.
 */
 
index b1fb674e3e8f87f9dd5294a400ae81c0de94dad0..257594179ada2ff1d3cc98c5339aa8fef63f868f 100644 (file)
@@ -52,7 +52,7 @@ XmlListModel {
 
 //![1]
     // XmlRole queries will be made on <book> elements
-    query: "/catalogue/book"
+    query: "/catalog/book"
 
     // query the book title
     XmlRole { name: "title"; query: "title/string()" }
@@ -71,14 +71,16 @@ XmlListModel {
 }
 //![1]
 
+//![2]
 ListView {
     width: 300; height: 200
     model: model
     delegate: Column {
-        Text { text: title + " (" + type + ")"; font.bold: true }
+        Text { text: title + " (" + type + ")"; font.bold: wanted }
         Text { text: first_author }
         Text { text: year }
     }
+//![2]
 }
 
 }
diff --git a/src/quick/doc/snippets/qml/xmlrole.xml b/src/quick/doc/snippets/qml/xmlrole.xml
new file mode 100644 (file)
index 0000000..70280e0
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="iso-8859-1" ?>
+<catalog>
+    <book type="Online" wanted="true">
+        <title>Qt 5 Cadaques</title>
+        <year>2014</year>
+        <author>Juergen Bocklage-Ryannel</author>
+        <author>Johan Thelin</author>
+    </book>
+    <book type="Hardcover">
+        <title>C++ GUI Programming with Qt 4</title>
+        <year>2006</year>
+        <author>Jasmin Blanchette</author>
+        <author>Mark Summerfield</author>
+    </book>
+    <book type="Paperback">
+        <title>Programming with Qt</title>
+        <year>2002</year>
+        <author>Matthias Kalle Dalheimer</author>
+    </book>
+ </catalog>