[PyQt] Help with "stringio" ops on QTextStream in Qt5

David Cortesi davecortesi at gmail.com
Thu Feb 13 23:39:40 GMT 2014


I am upgrading an app from PyQt4 to PyQt5.
This app makes frequent use of in-memory i/o by
creating a QTextStream based on a QString, e.g.:

> string = QString() # must stay in scope!
> stream = QTextStream(string)
> stream << "whatever, yadda yadda"
> # in another part of the forest...
> stream.seek(0)
> while not stream.atEnd():
>    foobar = stream.readLine()

How to make this work in the new API sans QStrings?
QTextStream(python-string-var) not unexpectedly
yields an error.  Do I need to recode all this to use
Python's stringIO class, or is there a way to preserve it?

Thanks for your suggestions,
Dave Cortesi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140213/a783267f/attachment.html>


More information about the PyQt mailing list