On Tue Mar 23 15:52:22 GMT 2010, Phil Thompson wrote:
> On Tue, 23 Mar 2010 16:34:39 +0100, Olivier Fournier
>
> <o.fournier at perigord.com> wrote:
> >
> > I would like to use the overloaded function QXmlQuery.evaluateTo (self,
> > QString).
[...]
> Mainly laziness on my part. I need to write some handwritten code to deal
> with immutable strings. I'll add...
>
> QXmlQuery.evaluateToString() -> str
>
> ...to tonight's snapshot. None will be returned if the evaluation fails.
I also ran into this recently, but just worked around it by using a QBuffer
to collect data for use in a QByteArray. Since the QXmlQuery writes its
results encoded as UTF-8, you can then create a QString from the QByteArray.
array = QByteArray()
buf = QBuffer(array)
buf.open(QIODevice.WriteOnly)
if query.isValid():
if query.evaluateTo(buf):
results = QString.fromUtf8(array)
print results
buf.close()
David
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt