[PyKDE] Converions between QString and str in PyQt4

Andreas Pakulat apaku at gmx.de
Fri Jan 20 18:31:30 GMT 2006


I have an issue with conversion between QString and str. The problem I
have is as follows:

create a QtCore.QVariant("true") and calling it's toBool() function
returns false, regardless of what the string actually contains

Use an explicit QtCore.QString("true") constructor and everythings fine. 

Now I know that in python explicit is better than implicit and thus my
question is: Is conversion between QString and str supposed to work
implicitly or is it expected to be done explicitly always?

Currently I think both cases are mixed, if I'm not totally mistaken
conversion from QString to str is implicitly done, but the other way
it's not. I recall a discussion about this topic before Phil began to
work on PyQt4, but I'm not sure about the outcome of that...


Don't look now, but the man in the moon is laughing at you.

More information about the PyQt mailing list