I'm currently developping a plug-in for a non Qt application.

This plug-in is a server with HMI all developped with Qt.

I guess the best to do is to create all the Qt objects in a same thread and take profit of signals and slots.

The plug-in is called by the application through its interface:
void init();
void run();
void term();

The server must be created in init().
run() is triggered by the user and show the HMI (a control panel of the server)

But the thread that creates all my Qt objects is not the GUI Thread. The main thread is the one that execute init() and makes running the host application. So, I can't end init() by calling QApplication::exec(). It's why a secondary thread is used to play the role of deamon, creator of all the Qt objects.

As this thread is not the GUI thread, I must elect it as the GUI thread.

How is it possible to do that ?

A post speaks about that but does'nt detail how to do. It seems to be related to the thread which loads the QtGui lib (or, maybe, initializes the global variables of this lib).

Thanks a lot if you can help me.