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. Many Processes one GUI
Forum Update on Monday, May 27th 2025

Many Processes one GUI

Scheduled Pinned Locked Moved General and Desktop
18 Posts 6 Posters 18.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
    lynardo
    wrote on last edited by
    #1

    Hi there!

    I want my application, to be in one GUI, but also to be splitted in some executables. How to do that?

    As I thought, that I can give some advice from the Main Part to the others, as well as positioning them or so on, over IPC. But I think, that there must be another way.

    Well if you don´t understand what I mean, look at Chrome, for each tab there is one Process, but it is only one GUI.

    Thanks for all answers

    What a nice world it could be if we all had Google...
    Oh, Yes I remeber, we all had Google

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cochise
      wrote on last edited by
      #2

      You can do this with QThead.
      http://doc.trolltech.com/4.7/qthread.html#details

      http://cochise.tumblr.com

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lynardo
        wrote on last edited by
        #3

        Thank you it helps me a lot

        What a nice world it could be if we all had Google...
        Oh, Yes I remeber, we all had Google

        1 Reply Last reply
        0
        • C Offline
          C Offline
          cochise
          wrote on last edited by
          #4

          You're welcome

          http://cochise.tumblr.com

          1 Reply Last reply
          0
          • G Offline
            G Offline
            giesbert
            wrote on last edited by
            #5

            But the solution that Crome uses is really multiple processes not multiple threads. If you use threads, crashing in one of them could crash the whole app. That is something, that Crome solved by using multiple processes....

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tobias.hunger
              wrote on last edited by
              #6

              Cochise: Nope, QThread is a thread. QThreads allow for parallel execution of code within the same address space. This implies that once one thread crashes all the others are brought down as well... this is very different from e.g. Chrome where a tab crashing does not stop the UI.

              Lynardo will actually need QProcess(es) if he is after the robustness and not just the parallel execution of codepathes.

              Lyandro: Chrome has one process for the UI and several rendering processes (one for each tab). The tab contents is most likely shared between UI and rendering process using shared memory. There probably is some more comfortable Inter Pprocess Communication (IPC) mechanism between the two for small bandwidth stuff (like "open url x" or "I am done rendering"). This is just guesses based on what I read about chrome, so I might be off target here:-)

              1 Reply Last reply
              0
              • C Offline
                C Offline
                cochise
                wrote on last edited by
                #7

                well. we can use a external program (webkit?) for render the pages and embed in main interface (in central widget?) with http://doc.qt.nokia.com/4.7/qx11embedcontainer.html or http://doc.qt.nokia.com/4.7/qx11embedwidget.html

                http://cochise.tumblr.com

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tobias.hunger
                  wrote on last edited by
                  #8

                  QtWebKit is a library, not an external program. I don't know whether QX11Embed* is a solution for lynardo either: It is XWindow specific and thus does not work on windows, Mac (at least not without running an X server) or Symbian.

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    cochise
                    wrote on last edited by
                    #9

                    only for the chromium comparsion i saw webkit. Repplace for "webkit based widget built as a external binary, who recive a url as inicialization parameter".

                    I don't know if the project of lyardo is a browser. May be a comercial system, a finantial manager, etc.

                    And yes, QX11Embed only work on X11. Mac can run X11 and Cygwin maybe too. If i had a windows i make a test of xembed uder cygwin.

                    And IPC is also a solution, but lyardo arks for another way.

                    http://cochise.tumblr.com

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      goetz
                      wrote on last edited by
                      #10

                      X11 on Mac is ugly. One should avoid it whenever possible. I guess the same applies for Windows. I'd really go with some kind of IPC or RPC.

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      1 Reply Last reply
                      0
                      • L Offline
                        L Offline
                        lynardo
                        wrote on last edited by
                        #11

                        Well an X11 server is not the right thing for me, because I had to use windows.
                        Chochise: No it isn´t a browser, I want to make a Programm with amy really complicatet mathematic and then to diasplay the result as a graphik.

                        So i tried QThread, but I think then the Programm is not Stable enough, because I´m a person, who is clicking on options button and so on, while programms are "thinking". And to let a process render which has no GUI, then Shared Memory, and display it on screen, would be to big for my RAM.

                        Well in this way if nobody has more Ideas, I hav to make it like that:

                        One Class in the mainprocess, handles the others, and sends commands as string to them like "hide" and so on. Then the Process has to Implement and to follow the advices. I really thinkt that that method is to slow, and to complicated, tht there must be another way. But it seems that it isn´t.

                        Thanks to all for their helpful answers

                        What a nice world it could be if we all had Google...
                        Oh, Yes I remeber, we all had Google

                        1 Reply Last reply
                        0
                        • G Offline
                          G Offline
                          goetz
                          wrote on last edited by
                          #12

                          If you are concerned about your "workers" could crash you should go for separate processes, each running as a separate executable application and connect them with some kind of IPC (maybe using the stdin and stdout channels).

                          If your workers are unlikely to crash (and if you don't need to detach the GUI from the workers) then it's better to use "QThread":http://doc.trolltech.com/4.7/qthread.html, these can communicate with your GUI thread directly using signals and slots. This works in both directions, so if you are changing your settings in the GUI you can tell your workers immediately.

                          BTW:
                          What should happen if you wildly click on some options buttons?
                          Why should that crash your application?
                          And how would you recover if you had split the GUI and your workers in different applications?
                          Which of both starts the others (does the GUI start the workers or the other way round)?
                          You would have to implement some watcher (catching a "QProcess":http://doc.trolltech.com/4.7/qprocess.html's "finished()":http://doc.trolltech.com/4.7/qprocess.html#finished signal and examinating the exitCode) in that case.

                          http://www.catb.org/~esr/faqs/smart-questions.html

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            giesbert
                            wrote on last edited by
                            #13

                            What you can do: create a GUI as one process and a rendering Executable (or calculation exe) as second process. Put all parameters e.g. in an XML file and create a QProcess to start the math app with the xml file as cmd parameter. So the calculation takes part in a seperate process. When it finishes, it stores the result again as XML (or whatever format you like) and the GUI can read the results and display them.
                            Simple solution with more than one process.....

                            Nokia Certified Qt Specialist.
                            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                            1 Reply Last reply
                            0
                            • T Offline
                              T Offline
                              tobias.hunger
                              wrote on last edited by
                              #14

                              Why would using shared memory be any bigger memory overhead than what you propose?

                              1 Reply Last reply
                              0
                              • G Offline
                                G Offline
                                giesbert
                                wrote on last edited by
                                #15

                                wouldn't it, but easier :-)
                                But I would normally also use QThread and do it i process....
                                Why doing IPC if it is not really recommended...?

                                Nokia Certified Qt Specialist.
                                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                                1 Reply Last reply
                                0
                                • L Offline
                                  L Offline
                                  lynardo
                                  wrote on last edited by
                                  #16

                                  Of course you´re right QThread is more useful and practicabler than IPC, I was just really interested in that, so my application now had many Threads and schows a waiting symbol at the Solutions view.

                                  Thanks for your great help, it was really interesting, but I´ve seen not all what you think about is easiely practicable at the moment. But maybe there is a module in Qt in the future.

                                  What a nice world it could be if we all had Google...
                                  Oh, Yes I remeber, we all had Google

                                  1 Reply Last reply
                                  0
                                  • T Offline
                                    T Offline
                                    tobias.hunger
                                    wrote on last edited by
                                    #17

                                    There already is "QtConcurrent":http://doc.qt.nokia.com/4.7/qtconcurrent.html to help with multi threaded programming. It among other things manages a pool of threads, assigning tasks to them when they are idle.

                                    1 Reply Last reply
                                    0
                                    • C Offline
                                      C Offline
                                      Charles
                                      wrote on last edited by
                                      #18

                                      You might also want to have a look at the Qt Service Framework:http://doc.qt.nokia.com/qtmobility-1.1.0/service-frameworks.html
                                      In 1.1, it supports Out of Process services, both in QtDBUS or QLocalSocket.

                                      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