[PyQt] PyQt4 Python File Object to QFile
David Boddie
dboddie at trolltech.com
Fri Feb 12 19:25:42 GMT 2010
On Fri Feb 12 06:55:21 GMT 2010, Russell Valentine wrote:
> I wonder if anyone ever bridged the gap between QFile and the Python
> File Object? It could be handy sometimes to go between the two.
[...]
> f is a python file object but, how can I use this in Qt? I realize I
> could save it to some temp file and reopen it with QFile but that seems
> unelegant.
Try this:
f = open(...)
qt_f = QFile()
qt_f.open(f.fileno(), QFile.ReadOnly)
http://www.riverbankcomputing.com/static/Docs/PyQt4/html/qfile.html#open-2
David
More information about the PyQt
mailing list