diff options
author | Topi Reinio <topi.reinio@digia.com> | 2014-03-17 09:37:31 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-18 12:00:58 +0100 |
commit | b456fb1a11302557ac51ac47c635ba993d1653a3 (patch) | |
tree | 76417df2d7ec3cd5e108707f5b2fc193def505a2 | |
parent | 17643c829d15d43a7d5e2955089595198903775c (diff) |
Doc: Reintroduce missing sample XML file for XMLRole documentation
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>
-rw-r--r-- | src/imports/xmllistmodel/qqmlxmllistmodel.cpp | 6 | ||||
-rw-r--r-- | src/quick/doc/snippets/qml/xmlrole.qml | 6 | ||||
-rw-r--r-- | src/quick/doc/snippets/qml/xmlrole.xml | 20 |
3 files changed, 29 insertions, 3 deletions
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp index 0b9be3105b..3c6967fd69 100644 --- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp +++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp @@ -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. */ diff --git a/src/quick/doc/snippets/qml/xmlrole.qml b/src/quick/doc/snippets/qml/xmlrole.qml index b1fb674e3e..257594179a 100644 --- a/src/quick/doc/snippets/qml/xmlrole.qml +++ b/src/quick/doc/snippets/qml/xmlrole.qml @@ -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 index 0000000000..70280e067d --- /dev/null +++ b/src/quick/doc/snippets/qml/xmlrole.xml @@ -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> |