Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Chrome like tab with separate process for each?
I'm trying to create a program with tab functionality like a text editor. When I click new, a new tab will be added to the maindow but in a separate process, like Chrome. So if one tab crashed the other tabs will be unaffected.
I have searched a lit but still don't know where to start.
well then the editor core would to be separate from
the GUI and communicated with mainwindow via network/pipes/IPC
to carry out editing functions. Or something like that.
So if the editor process crashes then rest still works.
But seems very overkill for text editor.
Hi, each tab will have more functions/calls attach to it, not only a text editor.
So is it that first I need to make a class for each of the functions I need like text editor, then make a tab class that calls all these classes. And then in the mainwindow, create a new instances of this tab class every time I want to make a new one? But isn't this still one single process overall?
You would not create instance but run a new process being a editor tab.
But im not sure how it would be possible to have all GUI in separate process and then
show is as one application.
What Chrome does is to run the rendering engine in own processes and only draw the result to the tabs
and sends interactions to the engine.
I don't quite understand. So Chrome has a central rendering engine that was connecting to a tab GUI? And on a new tab request the engine creates a separate process, and each process and the tab gui interact with one another through the engine?
@lansing If you want to do it like this you first should learn about IPC (Inter Process Communication), as you're going to communicate with different processes. One possibility is: http://doc.qt.io/qt-5/qsharedmemory.html
Hi, I have looked at several examples of qsharedmemory but I just don't see what it can do to my case. What is to be shared among the tabs?
What is to be shared among the tabs?
That's something you have to know. If you want to use one process for each tab then you need to communicate with all these processes, right? Each process has its own memory and is isolated from other processes, you can't easily exchange data between them, so you need to use some kind of IPC. If you still want to do it this way then you really need to learn IPC, there is no other way.
Hi, this is the idea I have for now:
I'll create a mainwindow program and text editor program. In the mainwindow program, it'll have qsharedmemory and qprocess and a button and the text editor program will have qsharedmeomory as well. When the button was clicked, it'll trigger a slot that start the text editor program with qprocess, and then set the geometry to make it looks like it was attaching to the mainwindow. When the button was clicked again, a new text editor process will start. And in the mainwindow I'll have some logic to hide the inactive process to make it looks like a tab.
Will this setup work?
@lansing Don't forget that each text editor will have its own window, which user can move around. You can integrate external windows into your main app using native APIs, but I don't know how exactly.
Ankita thakur last edited by
Hi. Did you get a solution for you problem. I am having a similar issue where I would like to create a multi tab window with each tab as a separate process.