Is it possible in Qt to run an external process inside a subwindow of the main process?
-
I have a multi document program (call it HostProgram) . I would wish to have a process (call it GuestProcess) managing each open documents inside HostProgram in order to improve stability (if one of the Guest Process crashes I'm not forced to close the HostProgram and the other running GuestProccesses). Is it possible using Qt library to render the GUI composing GuestProcess inside a SubWindow of HostProcess? If yes how?
Thanks in advance a lot for any help/hints you will be able to provide me.
-
On windows you can pass window HWND of HostProgram as an argument to GuestProcess, and use it as parent window in GuestProcess.
Qt way will be to use "QProcess":http://qt-project.org/doc/qt-4.8/qprocess.html and organize communication around read/write slots. So, GUI should be created in main program, but all data can be generated in guest process and signaled to host program.... You also can use sockets/pipes & shared memory...
-
My problem is that I have in the GuestProcess an OpenGL context and for efficiency reasons I cannot detach it from the GuestProcess. So I would wish to maintain OpenGL context inside the GuestProcess but the QGLWidget should be rendered inside a SubWindow provided by the HostProcess.
Something like the approach followed by Google Chrome that allocates a different process for each tab you opened. -
You can try this:
Create and initialize QGLWidget in main thread
create guest process and provide pointer to QGLWidget** as an argument or whatever
use this pointer to draw whatever you want.
Should work, but I've never played with QGLWidgets like what...
-
[quote author="AcerExtensa" date="1353921437"]You can try this:
Create and initialize QGLWidget in main thread
create guest process and provide pointer to QGLWidget** as an argument or whatever
use this pointer to draw whatever you want.
Should work, but I've never played with QGLWidgets like what...[/quote]
Hi,
this will not work. Pointer are only valid inside the process, that created them. Passing pointers from one process to another is not possible.