diff options
author | Frans Englich <frans.englich@nokia.com> | 2009-06-29 17:17:51 +0200 |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-06-29 18:25:51 +0200 |
commit | 1414c682c532a95a2204bc1b2d01d2493357b686 (patch) | |
tree | 3b4312d7d45eb609f5d7a1440d3211906fa24faa /src | |
parent | 555c481145ff87347c0f0be12f81632c9b5ef0be (diff) | |
download | qt4-tools-1414c682c532a95a2204bc1b2d01d2493357b686.tar.gz |
QXmlQuery: add setFocus(const QString &).
Requested by Girish and Jurgen. Useful for training and small examples.
Task-number: 245219
Reviewed-by: Tobias Koenig
AutoTest: Included in this submit.
Diffstat (limited to 'src')
-rw-r--r-- | src/xmlpatterns/api/qxmlquery.cpp | 19 | ||||
-rw-r--r-- | src/xmlpatterns/api/qxmlquery.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/xmlpatterns/api/qxmlquery.cpp b/src/xmlpatterns/api/qxmlquery.cpp index 2513725cf8..3d023a02a7 100644 --- a/src/xmlpatterns/api/qxmlquery.cpp +++ b/src/xmlpatterns/api/qxmlquery.cpp @@ -1039,6 +1039,25 @@ bool QXmlQuery::setFocus(QIODevice *document) } /*! + This function behaves identically to calling the setFocus() overload with a + QIODevice whose content is \a focus encoded as UTF-8. That is, \a focus is + treated as if it contained an XML document. + + Returns the same result as the overload. + + \overload + \since 4.6 + */ +bool QXmlQuery::setFocus(const QString &focus) +{ + QBuffer device; + device.setData(focus.toUtf8()); + device.open(QIODevice::ReadOnly); + + return setFocusHelper(this, &device); +} + +/*! Returns a value indicating what this QXmlQuery is being used for. The default is QXmlQuery::XQuery10, which means the QXmlQuery is being used for running XQuery and XPath queries. QXmlQuery::XSLT20 diff --git a/src/xmlpatterns/api/qxmlquery.h b/src/xmlpatterns/api/qxmlquery.h index 28ef5cbd19..4ddfc76da0 100644 --- a/src/xmlpatterns/api/qxmlquery.h +++ b/src/xmlpatterns/api/qxmlquery.h @@ -122,6 +122,7 @@ public: void setFocus(const QXmlItem &item); bool setFocus(const QUrl &documentURI); bool setFocus(QIODevice *document); + bool setFocus(const QString &focus); void setInitialTemplateName(const QXmlName &name); void setInitialTemplateName(const QString &name); |