[PyKDE] python lists of QStrings

Giovanni Bajo rasky at develer.com
Thu Apr 14 13:43:34 BST 2005


I have a problem. I find it useful to build lists of strings in Python and
pass them to methods like QListBox.insertStrList. The problem is that if I
use Qt's i18n support, I end up with Python lists of QStrings, such as:

items = [ self.tr("Foo"), self.tr("Bar"), self.tr("FooBar") ]

There is no easy way to pass this thing to a QListBox/QComboBox withou an
explicit iteration.

I believe that we could use an implicit conversion from the above to
QStringList. Either to that, or to QStrList, but I think the former maps
better: QStrList is a list of char* in C++, after all.
Giovanni Bajo

More information about the PyQt mailing list