⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Multi processes in a single GUI application.

  • I have a custom QWidget that performs some graphics rendering and handles settings using Qt GUI elements, and there can be multiple widgets that can be invoked and plugged in to Tabbed Main Window. If I have to design each tab as a process itself so that it looks a single application to the user but each tab is a child process on its own. In this scenario, which is the best recommended IPC Mechanism that I can adopt.

  • @chaithubk
    Do you mean that these separate tabs/widgets are already separate processes, and there is nothing you can do about it? (BTW, you can't [easily] get widgets in other processes embedded into parent process.) Because unless this is how it has to be, it does not sound like you want sub-processes for choice here....

  • @jonb I wanted to check what would it take to implement each tab to be a separate process.

  • @chaithubk
    If you really mean separate processes, you will not be able to have each process/tab content having QWidgets, or anything similar, which are somehow accessible to the main program/other tabs. Even if you did set some sort of IPC protocol, it would be slow/unwieldy/not doable to have much interaction between the tabs and the sub-processes.

    Basically a sub-process is a "black box" to the caller, and vice versa. You can only really communicate with it via stdin/out/err, or set up your own IPC sockets. It can't "put" widgets into your parent's UI.

    Given that, depending on what you want to do in the processes/tabs, if you are writing both the parent and the children you would be expected to implement them all in the same single Qt process. So what is your your use-case?

  • @jonb My use case is something like for example:
    When I launch my application it will have a Dock widget with a default tab which has dashboard with list of files. When I click on a file, I will have a file reader component that reads the file and displays it in the separate tab in the main application, same way from the dashboard I can click on an another file which again should display the file in a separate tab. Now I am thinking if it is possible to have each tab to be run as a different child process so that if one file fails to display it's contents or malfunctions it is just that tab that get's killed and the application will function with the rest of the files. Make sense ?

  • @chaithubk
    This is my last statement. I have tried each time to get you to explain what you mean by "a process which displays its output in a (parent process's tab)", or your "if it is possible to have each tab to be run as a different child process", and you have not answered or not understood. I don't see how you think you can have any sub-process output into a graphical widget in another process, which is what you keep saying you are going to do. But I have said this repeatedly so there is no more to say.

    I leave it now to you to discover for yourself, or someone else to explain so that you understand them.

  • @chaithubk said in Multi processes in a single GUI application.:

    which is the best recommended IPC Mechanism that I can adopt

    I would do networking. It does not limit the processes to a particular machine. You could even write your front end to the processes in a browser if you wanted to. You will need a way to coordinate your list of processes and act as a broker. Something that can track and register a process with itself. Then whatever frontend connects can just query the broker.

  • Lifetime Qt Champion


    I wonder if the QtRemoteObjects module would be of help.

  • Which operating system?

    If only Linux shall be supported, then I recommend D-BUS and QtWayland compositor, but please be noted is not a beginner job.

  • @shazter It's Windows desktop application. Yeah I started understanding it's not an easy task. I will read more through the documentation and put a proper technical question probably rather than just an idea.

  • Then the way to go would be TCP for IPC with QDataStream with good protocol or shared memory. I dont know which WindowManager is suitable Windows for the different processes. Maybe as good starting point for study is https://doc.qt.io/Neptune3UI/neptune3ui-overview.html, the source code is available in Github. Be aware is for Linux and not Windows.

Log in to reply