summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-06-29 17:17:51 +0200
committerFrans Englich <frans.englich@nokia.com>2009-06-29 18:25:51 +0200
commit1414c682c532a95a2204bc1b2d01d2493357b686 (patch)
tree3b4312d7d45eb609f5d7a1440d3211906fa24faa /src
parent555c481145ff87347c0f0be12f81632c9b5ef0be (diff)
downloadqt4-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.cpp19
-rw-r--r--src/xmlpatterns/api/qxmlquery.h1
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);