Reputation: 602
I'm facing this issue of how to run different parts of an Application in separate process as the member function for QProcess that sets a process name requires a full path.
void setProgram(const QString &program)
But the process i'm trying to run is basically a module of the Main Application. So let me explain what i'm trying to achieve basically.
The application has QMainWindow as the central window which will controls all the different modules, monitor them, stop/restart them, communicate with them via IPC mechanism.
And so on. There are a number of such heavy weight modules in this application so using a threading approach is not desirable as basically these modules needs to run in their separate memory space and will act as child processes of the MainWindow process. The communication between the processes will be nicely handled using D-Bus, SharedMemory.
But what i can't figure out is how to actually create these child processes when the user clicks on the specific actions/buttons in the MainWindow. Again these modules are very much intergrated in one app and can't be called externally due to security and integrity constraints. So please let me know of any way to achieve this.
Upvotes: 2
Views: 1836
Reputation: 98425
One approach is to use the same executable, and control which module is launched using command line arguments. See a trivial example in this answer. Inter-process communication can be done using local sockets, you can also send slot calls across processes - see e.g. CuteIPC.
Upvotes: 2