[PyQt] SIP - argument 1 has invalid type

Phil Thompson phil at riverbankcomputing.com
Wed Dec 31 10:57:32 GMT 2008


On Wed, 31 Dec 2008 11:51:23 +0100, "Jan Kaluza" <hanzz.k at gmail.com> wrote:
> Hi,
> I'm trying to wrap one C++ library to SIP and I have one problem with
> constructor of one QWidget based class... Here is this class in .sip
> file:
> 
> class VideoWidget : QWidget
> {
> %TypeHeaderCode
> #include <psimedia.h>
> %End
> public:
> 	VideoWidget(QWidget *parent = 0);

You need to add a /TransferThis/ annotation to "parent".

> 	~VideoWidget();
> 
> 	virtual QSize sizeHint() const;
> 
> protected:
> 	virtual void paintEvent(QPaintEvent *event);
> 
> };
> 
> and here is what I'm trying to do:
> 
> PsiMedia.VideoWidget(QtGui.QWidget())

You need to keep a reference to the QWidget parent.

> or PsiMedia.VideoWidget(self.ui.parent)
> 
> the problem is here :) :
> 
> Traceback (most recent call last):
>   File "test.py", line 790, in <module>
>     w=mainWindow()
>   File "test.py", line 471, in __init__
>    
self.previewSelf=PsiMedia.VideoWidget(QtGui.QWidget())#self.ui.vw_self)
> TypeError: argument 1 of VideoWidget() has an invalid type
> 
> 
> Does anybody know what I'm doing wrong?

Phil


More information about the PyQt mailing list