[PyKDE] QString in PyQt4 - Request for Comments

Robert Jonsson rj at spamatica.se
Tue Oct 18 20:09:23 BST 2005


Hi,

On Tuesday 18 Oct 2005 19:24, Phil Thompson wrote:
> I'm wondering whether QString should be dropped in PyQt4 in order to make
> it more Pythonic.
>
> At the moment Python strings and unicode strings are automatically
> converted to QStrings when passed as arguments - so there would be no
> change there. If a QString was returned by a method or an operator then a
> unicode string would be returned instead.
>
> Obviously you would lose all of QString's methods and would have to rely on
> what Python gives you for manipulating strings.

Being very much a newbie at this stuff I have one question. 
I'm building up nerve to implement a python scripting interface for a fairly 
large Qt based c++ application. I did some prototyping with Qt3 a while ago 
where I got the basics working (making calls from python etc...) Now, some of 
the calls would definitely return QString from the c++ code, would they then 
return unicode to the python code?

Regards,
Robert

>
> One of the limitations of QString has been that you couldn't do...
>
> q = "Py" + QString("Qt")
>
> ...but with current snapshots you can - so this is an argument for keeping
> QString as it has become easier to use.
>
> BTW, the following is a consequence of the additional support...
>
> s = "Py"
> # s is of type str
> s += QString("Qt")
> # s is now of type QString
>
> Comments, opinions welcome.
>
> Phil
>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

-- 
http://spamatica.se/musicsite/




More information about the PyQt mailing list