[PyKDE] Mixing Qt-App and PyQt

Phil Thompson phil at riverbankcomputing.co.uk
Thu Jul 3 15:20:00 BST 2003


On Thursday 03 July 2003 11:44 am, Andrew Smart wrote:
> Hi folks,
>
> I'm still stuck with following problem/idea:
>
> I have a Qt-App build C++ application.
>
> I want to execute a Python script within this C++ application
> (embedding Python is already done).
>
> I have a Window object which is created within the C++ application.
> I want to pass this QWindow object to the Python script as a parameter.
>
> Since PyQt has it own wrapper around the Qt objects I guess I have
> to create a PyQt-QWindow object and pass it to the Python script.
>
> The point I'm stuck is that I have no idea how to mix the existing
> C++ - QWindow object with the PyQt-Window object. I guess I would
> have to fiddle around with the pointers.
>
> 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




More information about the PyQt mailing list