[PyKDE] QString in PyQt4 - Request for Comments
bazwal at ftml.net
Thu Oct 20 21:01:43 BST 2005
On Thursday 20 Oct 2005 07:51, Simon Edwards wrote:
> If methods like QTextEdit.text() could magically read minds and return a
> Python string or a QString when desired, then everyone would be happy. :-)
> Really, what we have in PyQt3 works fine with string except for in the case
> of return types.
Yes, at the moment we are having to write:
qt_str = QTextEdit.text()
py_str = unicode(QTextEdit.text())
... but possibly we'd like to write:
py_str = QTextEdit.text()
qt_str = QString(QTextEdit.text())
... such that the QString constructor somehow disables the default conversion
to a python unicode object and simply returns the original qstring.
Of course, this second part is total hand-waving. However, IMHO the syntax is
so nice that I thought it worth at least putting it out there.
Is there any way something like this could be made to work?
More information about the PyQt