[PyKDE] Qt4 QPolygon

Phil Thompson phil at riverbankcomputing.co.uk
Wed Jul 5 11:22:09 BST 2006


On Saturday 01 July 2006 1:06 pm, Jeremy Sanders wrote:
> Hi -
>
> Is there a simple way to convert a python list of coordinates into a
> QPolygon in qt4? It seems that passing python lists full of QPoint values
> seems very memory intensive, taking several times more memory than a
> similar list of Python objects.
>
> Would it be possible to allow straight Python lists to be passed to
> functions which take arrays of points?
>
> QPainter.drawLines([1,2,3,4,...]) would be very handy. I seem to
> remember you could do something similar with qt3 using
> QPointArray([1,2,3,4...]).

I've added QPolygon([1, 2, 3, 4, ...]) and setPoints([1, 2, 3, 4, ...]). 
However you can't do QPainter.drawLines([1, 2, 3, 4, ...]), you have to 
convert to a QPolygon first. You couldn't do the equivalent in PyQt3 either.

Phil




More information about the PyQt mailing list