summaryrefslogtreecommitdiffstats
path: root/src/xmlpatterns
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-06-29 15:17:51 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-06-29 16:25:51 (GMT)
commit1414c682c532a95a2204bc1b2d01d2493357b686 (patch)
tree3b4312d7d45eb609f5d7a1440d3211906fa24faa /src/xmlpatterns
parent555c481145ff87347c0f0be12f81632c9b5ef0be (diff)
downloadQt-1414c682c532a95a2204bc1b2d01d2493357b686.zip
Qt-1414c682c532a95a2204bc1b2d01d2493357b686.tar.gz
Qt-1414c682c532a95a2204bc1b2d01d2493357b686.tar.bz2
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/xmlpatterns')
-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 2513725..3d023a0 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 28ef5cb..4ddfc76 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);