[PyQt] General questions on parsing large QStrings

David Cortesi davecortesi at gmail.com
Sun May 12 21:19:55 BST 2013


For an app to be built with PyQt5/Qt5, I will have a
QPlainTextEdit in which the document may be quite
sizable, 500K characters or more.

I will want at times to inspect the document character
by character, or possibly apply Python relib REs to it.

I am somewhat at sea regarding the relationship between
a const QString such as returned by QPlainTextEdit.toPlainText()
and a Python3 unicode string, and -- just in general -- about
the best way to do intensive examination of big strings.
Is there a copy involved in, e.g.

    docstring = unicode( myEditor.toPlainText() )

I note that the PyQt4 QString reference omits the
QString.begin() or .constBegin() etc methods that return an
"STL-style iterator" so that's out. Is there some internal magic
to integrate the QString type into Python's "for" mechanism
so that "for c in myEditor.toPlainText()" might be more
efficient than making a Python3 string and iterating on it?

Also in regard to making intensive loops faster,
how well do PyQtx calls integrate with Cython or PyPy?

Thanks for any insights,

Dave Cortesi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20130512/02f6c95a/attachment.html>


More information about the PyQt mailing list