AW: [PyKDE] Mixing Qt-App and PyQt

Phil Thompson phil at riverbankcomputing.co.uk
Mon Jul 7 13:02:00 BST 2003


On Sunday 06 July 2003 11:42 pm, Andrew Smart wrote:
> pykde-admin at mats.imk.fraunhofer.de wrote:
> > On Thursday 03 July 2003 11:44 am, Andrew Smart wrote:
> >> Hi folks,
>
> ...
>
> >> Are there some examples around how to pass C++ - Qt-Objects to
> >> the PyQt lib?
> >
> > sipMapCppToSelf() should do what you want...
> >
> > Python_QWindow = sipMapCppToSelf(C++_QWindow,sipClass_QWindow)
> >
> > ...and link your app against the SIP module.
> >
> > Phil
>
> Hi Phil,
>
> "link your app against the SIP modules" isn't that easy as it
> sounds...
>
> I run against 3 major troubles:
>
> - Its "sipClass_QWindow" but "sipClass_QWindowStyle"
>   Is this correct?
>
> - I have to build the sip module as static library (its build
>   as dll under windows) (I use staticlib instead of dll in the
>   .pro file)
>
> - Additionally I have to build the PyQt library as static library,
>   because I need the sipClass_QWindowStyle. (change the "dll" in
>   the build.py to "staticlib")

QWindow and QWindowsStyle (not QWindowStyle) are different classes. QWindow 
was dropped in Qt v2.

You will also need to link against the qtc module.

> One additional question:
>
> Can I use the sipMapCppToSelf - function for object which come
> from derived classes?

A assume you mean derived in C++. You can do it, but, as far as PyQt is 
concerned, its type will be the base class. If you want PyQt to recognise the 
derived class then you need to SIP it.

> I have a QWindow-based derived MyQWindow-class which I would like
> to use. I fear that this won't work... but until I can not build
> a static version of the PyQt under Borland I will have to
> wait until this problem is solved.
>
> Andrew

Phil




More information about the PyQt mailing list