Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Chrome like tab with separate process for each?
QtWS25 Last Chance

Chrome like tab with separate process for each?

Scheduled Pinned Locked Moved Unsolved General and Desktop
chrometabs
11 Posts 4 Posters 2.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lansing
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      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.

      L 1 Reply Last reply
      3
      • mrjjM mrjj

        Hi
        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.

        L Offline
        L Offline
        lansing
        wrote on last edited by
        #3

        @mrjj

        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?

        mrjjM 1 Reply Last reply
        0
        • L lansing

          @mrjj

          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?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @lansing
          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.

          L 1 Reply Last reply
          1
          • mrjjM mrjj

            @lansing
            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.

            L Offline
            L Offline
            lansing
            wrote on last edited by
            #5

            @mrjj

            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?

            jsulmJ 1 Reply Last reply
            0
            • L lansing

              @mrjj

              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?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @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
              http://doc.qt.io/qt-5/qtcore-ipc-sharedmemory-example.html

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              L 1 Reply Last reply
              2
              • jsulmJ jsulm

                @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
                http://doc.qt.io/qt-5/qtcore-ipc-sharedmemory-example.html

                L Offline
                L Offline
                lansing
                wrote on last edited by
                #7

                @jsulm

                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?

                jsulmJ 1 Reply Last reply
                0
                • L lansing

                  @jsulm

                  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?

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @lansing said in Chrome like tab with separate process for each?:

                  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.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  L 1 Reply Last reply
                  2
                  • jsulmJ jsulm

                    @lansing said in Chrome like tab with separate process for each?:

                    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.

                    L Offline
                    L Offline
                    lansing
                    wrote on last edited by
                    #9

                    @jsulm

                    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?

                    jsulmJ 1 Reply Last reply
                    0
                    • L lansing

                      @jsulm

                      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?

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @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.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        Ankita thakur
                        wrote on last edited by
                        #11

                        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.

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved