Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, February 2008
Multiple QApplication support


Message 1 in thread

I'm going to repeat a theme that I've read in a few posts, but haven't
really seen any satisfactory answer to (So I apologize if I've just missed
the answer). The basic problem is combining two independent qt-enabled
applications together in an elegant/seamless manner. Here's an example:

I have one data acquisition application written in C++ with Qt. I also have
analysis software written in python with Qt. I want to combine these two
applications together by embedding a python interpreter into the C++ app,
but for various reasons it is not possible to have the two running in the
same thread. This situation is impossible, however, since there can be only
one QApplication event loop running in the entire application.

A great solution would be to simply allow the creation of multiple
QApplication instances that do not communicate (except possibly by event
posting or other means). This way the python application can easily run on
its own or embedded, regardless of whether the C++ application is already
using Qt.

I've seen this problem a few different times--people implementing plugins
from preexisting applications, people running multiple threads that need to
control their own GUIs, etc.

So my questions are:

1) How have people worked around this problem? Anything really elegant? (or
is my understanding of the problem totally off-base?)

2) Is there a good reason that we can't have multiple QApplication instances
running in multiple threads, as long as they simply behave as independent
applications?


Thanks,
Q