diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-26 08:04:36 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-26 08:04:36 (GMT) |
commit | 124efaa694316a4e02684fde151395d8e1d28b7a (patch) | |
tree | 4acede8c724bb5a20ef523ff9c2efe2917e08bfd /src/declarative/util/qdeclarativexmllistmodel.cpp | |
parent | 7120119af835c139b8808e7dcdeec3eb11b0b36d (diff) | |
parent | b08165d372e60c0c61b25dbaf5d0340ce8f985bc (diff) | |
download | Qt-124efaa694316a4e02684fde151395d8e1d28b7a.zip Qt-124efaa694316a4e02684fde151395d8e1d28b7a.tar.gz Qt-124efaa694316a4e02684fde151395d8e1d28b7a.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:
Doc fixes, improvements
Allow js files with '.pragma library' to be used from WorkerScript
Add more examples of XPath expressions to XmlRole.
Open input panel on press if TextInput or TextEdit are already focused but panel has been closed
Fix horizontal/verticalCenter anchors bug.
Fix TextEdit clipping when not wrapped. Rename most-useful-wrap-mode to "Wrap".
Fix for qml reloaded in qml viewer not being maximized properly on a device
Unify naming of import plugin targets
Add a way to control when software input panels are shown in TextInput and TextEdit elements
Replace QTime with QElapsedTimer
Fix Gradient doc snippet.
Diffstat (limited to 'src/declarative/util/qdeclarativexmllistmodel.cpp')
-rw-r--r-- | src/declarative/util/qdeclarativexmllistmodel.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index d08e37b..4f9355b 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -80,7 +80,11 @@ typedef QPair<int, int> QDeclarativeXmlListRange; /*! \qmlproperty string XmlRole::name - The name for the role. This name is used to access the model data for this role from Qml. + + The name for the role. This name is used to access the model data for this role. + + For example, the following model has a role named "title", which can be accessed + from the view's delegate: \qml XmlListModel { @@ -91,19 +95,27 @@ typedef QPair<int, int> QDeclarativeXmlListRange; ListView { model: xmlModel - Text { text: title } + delegate: Text { text: title } } \endqml */ /*! \qmlproperty string XmlRole::query - The relative XPath query for this role. The query should not start with a '/' (i.e. it must be - relative). + The relative XPath expression query for this role. The query must be relative; it cannot start + with a '/'. - \qml - XmlRole { name: "title"; query: "title/string()" } - \endqml + For example, if there is an XML document like this: + + \quotefile doc/src/snippets/declarative/xmlrole.xml + + Here are some valid XPath expressions for XmlRole queries on this document: + + \snippet doc/src/snippets/declarative/xmlrole.qml 0 + \dots 4 + \snippet doc/src/snippets/declarative/xmlrole.qml 1 + + See the \l{http://www.w3.org/TR/xpath20/}{W3C XPath 2.0 specification} for more information. */ /*! @@ -521,9 +533,12 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla \endqml The \l {XmlListModel::query}{query} value of "/rss/channel/item" specifies that the XmlListModel should generate - a model item for each \c <item> in the XML document. The XmlRole objects define the + a model item for each \c <item> in the XML document. + + The XmlRole objects define the model item attributes; here, each model item will have \c title and \c pubDate attributes that match the \c title and \c pubDate values of its corresponding \c <item>. + (See \l XmlRole::query for more examples of valid XPath expressions for XmlRole.) The model could be used in a ListView, like this: @@ -559,8 +574,6 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla If multiple key roles are specified, the model only adds and reload items with a combined value of all key roles that is not already present in the model. - - \sa {declarative/xml/xmldata}{XML data example} */ QDeclarativeXmlListModel::QDeclarativeXmlListModel(QObject *parent) |