[PyKDE] PyQt4 QStringList (again)

Doug Bell dougb at bellz.org
Thu Jan 26 14:01:04 GMT 2006


Hi,

I didn't get any replies to my earlier message about QStringList in
PyQt4, but maybe it wasn't clear.  So I'll try again.

In the example programs, QStringLists are created using stream
operators:

   s = QtCore.QStringList()
   s << 'String 1' << 'String 2'

This method works, but it isn't very Pythonic.  If you already have a
Python list of strings, it requires an extra iteration through the list.

My preference would be for this to work:

   s = QtCore.QStringList(['String 1', 'String 2'])  # doesn't work

Is this possible?  The use of QStringLists to initialize widgets is more
common in Qt4 than it was in Qt3, so it would be nice to have an easier
implementation.

Thanks,
Doug.




More information about the PyQt mailing list