[PyQt] Fwd: Re: c++ app integrate PyQt
David Boddie
davidb at met.no
Tue Oct 1 10:46:52 BST 2013
On Tue Oct 1 03:05:55 BST 2013, John Fabiani wrote:
> Sorry if I mis-led you somewhere. The C++ app has been around for many
> years and is NOT going to be rewritten anytime soon. I want to
> integrate a python solution that will allow me to create new content
> using python all running within the C++ app loop. I'm hoping I can do
> it with PyQt. Creating the library would work - it would allow me to
> test and work in python. There are only a few things I need the python
> to know about from the C++ side - the login data, a couple of pieces of
> data, and one Class. After those minor things I don't need a thing.
> That said, it would be nice if the python side could call up some of the
> C++ forms.
I've done things with embedding in the past and never really liked the
process of starting up a Python interpreter from within a C++ application.
For something I'm currently working on, I decided to do what Matt suggests,
which is to build the application as a library - for a qmake-based build
system, this basically means changing the TEMPLATE line in its .pro file to
TEMPLATE = lib
Then you create wrappers for the classes you need. If your application's
main() function is simple - creates an application, creates a window, opens
it - then you can start by creating a wrapper for the window class and
writing an equivalent Python script to start the application.
I would put some examples on the (unofficial) PyQt Wiki but it appears to
have disappeared again.
David
More information about the PyQt
mailing list