[PyQt] Unable to directly create a QChar from unicode string
Christoph Burgmer
chrislb at gmx.de
Fri Jan 16 16:48:58 GMT 2009
Creating a QChar from a len() == 1 unicode object fails with a TypeError:
$ python
Python 2.5.2 (r252:60911, Jan 4 2009, 17:40:26)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtCore import QChar, QString
>>> a = u'你'
>>> len(a)
1
>>> QChar(a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: argument 1 of QChar() has an invalid type
>>> QString(QChar(QString(a).at(0))) == a
True
>>>
I have to chose the way around using QString::at()
Is that a bug?
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090116/bfa231c5/attachment.html
More information about the PyQt
mailing list