[PyKDE] Python list handling for QRect, QPoint, and QSize

Phil Thompson phil at river-bank.demon.co.uk
Mon Nov 4 19:58:01 GMT 2002


On Monday 04 November 2002 6:36 pm, Hans-Peter Jansen wrote:
> Hi Phil,
>
> since I catched the flu this weekend, I think of contributing something
> useful to PyQt. Namely the IMHO missing handling of python lists, where
> QRect, QPoint, and QSize objects are expected. (QColor?)

I'm not sure I understand. Are you saying that you want to pass a list of 
(say) x and y coordinates wherever a QPoint was expected? (Wouldn't a tuple 
be better?)

Or are you saying that you want to make QPoint behave a bit like a list?

> On my first cursory look, there seem to be to ways, but I don't know
> their implications:
>
> 1) implement __len__(), __getitem__() like in qstringlist.sip
> 2) %MappedType Qxyz<QInt>, like in qvaluelist.sip
>
> Q1) Why is __setitem__ missing from 1

Because I'm lazy and nobody has complained.

> Q2) Does method 2 provide transparent conversion from and to the correct
>     types, whereever they're used? (e.g. QObject)

Yes.

Phil




More information about the PyQt mailing list