[PyKDE] PyQt4 QStringList (again)

Phil Thompson phil at riverbankcomputing.co.uk
Thu Jan 26 14:26:20 GMT 2006


On Thursday 26 January 2006 2:01 pm, Doug Bell wrote:
> 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.

I haven't forgotten it - just hasn't reached the top of the pile yet.

Phil




More information about the PyQt mailing list