[PyKDE] QCanvasItem constructor

Phil Thompson phil at river-bank.demon.co.uk
Sun Dec 3 18:16:26 GMT 2000

Boudewijn Rempt wrote:
> I have a feeling I've found a bug in the wrapping of QCanvasItem - it
> doesn't recognize a subclassed QCanvas as a canvas:
>   File "kurailviewer.py", line 41, in ?
>     main()
>   File "kurailviewer.py", line 28, in main
>     canvas=kuraCanvas()
>   File "kurailviewer.py", line 14, in __init__
>     self.lines.append(kuraCanvasItem(self))
>   File "kurailviewer.py", line 7, in __init__
>     QCanvasItem.__init__(self, canvas)
>   File "/usr/local/lib/python2.0/site-packages/qt.py", line 172, in
> __init__
>     libqtc.sipCallCtor(191,self,args)
> TypeError: Invalid argument types to QCanvasItem()

It's a documentation bug. If my understanding of C++ is correct,
QCanvasItem has a private, virtual abstract member funtion
(collidesWith()) so it can only be sub-classed by classes defined as
friends. The friends are the other canvas item classes - you must
sub-class from one of these.

I've updated the docs to try and make this clearer.


More information about the PyQt mailing list