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. optimizing gui and parralel processing?
Forum Updated to NodeBB v4.3 + New Features

optimizing gui and parralel processing?

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 7 Posters 661 Views 1 Watching
  • 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.
  • jsulmJ jsulm

    @aravmadd said in optimizing gui and parralel processing?:

    proc->waitForFinished();

    This will block your GUI until process finishes. Don't do this!
    Connect a slot to https://doc.qt.io/qt-5/qprocess.html#finished signal instead. And move this code

    QString result = proc->readAllStandardOutput();
    ui->plainTextEdit->appendPlainText(result);
    

    to that slot...

    A Offline
    A Offline
    aravmadd
    wrote on last edited by
    #4

    @jsulm said in optimizing gui and parralel processing?:

    QString result = proc->readAllStandardOutput();
    ui->plainTextEdit->appendPlainText(result);

    HI Thanks for replying and giving your valuable time and suggestions. However i didnt get/ understood to do what you have said .

    I understood like this
    connect(proc, SIGNAL(finished(int , QProcess::ExitStatus )),
    this, SLOT(i am not sure which slot sorry for my stupid questiom));

    jsulmJ 1 Reply Last reply
    0
    • A aravmadd

      @jsulm said in optimizing gui and parralel processing?:

      QString result = proc->readAllStandardOutput();
      ui->plainTextEdit->appendPlainText(result);

      HI Thanks for replying and giving your valuable time and suggestions. However i didnt get/ understood to do what you have said .

      I understood like this
      connect(proc, SIGNAL(finished(int , QProcess::ExitStatus )),
      this, SLOT(i am not sure which slot sorry for my stupid questiom));

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

      @aravmadd said in optimizing gui and parralel processing?:

      i am not sure which slot sorry for my stupid questiom

      Well, your own slot inside Widget class. Simply add a slot in Widget with same parameters as the signal.

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

      A 1 Reply Last reply
      1
      • jsulmJ jsulm

        @aravmadd said in optimizing gui and parralel processing?:

        i am not sure which slot sorry for my stupid questiom

        Well, your own slot inside Widget class. Simply add a slot in Widget with same parameters as the signal.

        A Offline
        A Offline
        aravmadd
        wrote on last edited by
        #6

        @jsulm Thanks i will give a try. Will update in forum if i can succefully implement!! Many Thanks :-)

        mrjjM 1 Reply Last reply
        0
        • A aravmadd

          @jsulm Thanks i will give a try. Will update in forum if i can succefully implement!! Many Thanks :-)

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

          @aravmadd
          Hi
          Just so im sure i understand.
          You talk about doing heavy calc in app, calc, but you seem to show code running an extern process (another .exe)

          If you mean to run some other app, all is fine but i just have to ask :)

          S 1 Reply Last reply
          0
          • mrjjM mrjj

            @aravmadd
            Hi
            Just so im sure i understand.
            You talk about doing heavy calc in app, calc, but you seem to show code running an extern process (another .exe)

            If you mean to run some other app, all is fine but i just have to ask :)

            S Offline
            S Offline
            sm2770s
            wrote on last edited by
            #8

            @mrjj HI! YOU are right i am also running other executable after taking all other inputs from gui. For this i am using process.

            I am also doing some heavy math calc for example using EIgen Library and other stuff to do some moderate math. But for doing this thing it is taking sometime, and during this time my gui gets blocked because of things which already mentioned by @jsulm and @JonB

            JonBJ 1 Reply Last reply
            0
            • S sm2770s

              @mrjj HI! YOU are right i am also running other executable after taking all other inputs from gui. For this i am using process.

              I am also doing some heavy math calc for example using EIgen Library and other stuff to do some moderate math. But for doing this thing it is taking sometime, and during this time my gui gets blocked because of things which already mentioned by @jsulm and @JonB

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #9

              @sm2770s
              Well what we and you have been talking about here is QProcess, which you will solve by using signals and slots. If you have heavy Eigen calculations you need to call in the Qt process then you will have to use separate threads if you need to keep the UI responsive.

              S 1 Reply Last reply
              1
              • JonBJ JonB

                @sm2770s
                Well what we and you have been talking about here is QProcess, which you will solve by using signals and slots. If you have heavy Eigen calculations you need to call in the Qt process then you will have to use separate threads if you need to keep the UI responsive.

                S Offline
                S Offline
                sm2770s
                wrote on last edited by
                #10

                @JonB said in optimizing gui and parralel processing?:

                which you will solve by using signals and slots. If you have heavy Eigen calculations you need to call in the Qt process then you will have to use separate threads if you need to keep the UI responsive.

                HI Jon! As of now i am planning to move my calculations into executable so it can be easy and my executable does that math stuff and i think that would be optimistic way.

                But what i would like to try for now is each button/checkbox or lineedit should run without making my gui unresponsive by using different process. For time being i am trying to ignore heavy calculations and give a try.

                Can you give some suggestion if this approach seems legit?

                A JonBJ 2 Replies Last reply
                0
                • S sm2770s

                  @JonB said in optimizing gui and parralel processing?:

                  which you will solve by using signals and slots. If you have heavy Eigen calculations you need to call in the Qt process then you will have to use separate threads if you need to keep the UI responsive.

                  HI Jon! As of now i am planning to move my calculations into executable so it can be easy and my executable does that math stuff and i think that would be optimistic way.

                  But what i would like to try for now is each button/checkbox or lineedit should run without making my gui unresponsive by using different process. For time being i am trying to ignore heavy calculations and give a try.

                  Can you give some suggestion if this approach seems legit?

                  A Offline
                  A Offline
                  Anonymous_Banned275
                  wrote on last edited by Anonymous_Banned275
                  #11

                  @sm2770s said in optimizing gui and parralel processing?:

                  @JonB said in optimizing gui and parralel processing?:

                  which you will solve by using signals and slots. If you have heavy Eigen calculations you need to call in the Qt process then you will have to use separate threads if you need to keep the UI responsive.

                  HI Jon! As of now i am planning to move my calculations into executable so it can be easy and my executable does that math stuff and i think that would be optimistic way.

                  But what i would like to try for now is each button/checkbox or lineedit should run without making my gui unresponsive by using different process. For time being i am trying to ignore heavy calculations and give a try.

                  Can you give some suggestion if this approach seems legit?

                  I may be reading this discussion wrong, but...

                  If there is a time consuming task, it does not matter what approach you take - your GUI has to wait until the task returns valid data.
                  Perhaps "blocking (GUI) " is incorrect term to use.
                  Not sure if I agree to try to fool the user that the code is magically working "faster than a speeding bullet".
                  My approach - KISS - I prefer QConnectivity whoops - wrong word - QtConcurrent and I use it to let the user know it is actually taking time to finish the task.
                  Just my opinion.

                  S JoeCFDJ 2 Replies Last reply
                  0
                  • S sm2770s

                    @JonB said in optimizing gui and parralel processing?:

                    which you will solve by using signals and slots. If you have heavy Eigen calculations you need to call in the Qt process then you will have to use separate threads if you need to keep the UI responsive.

                    HI Jon! As of now i am planning to move my calculations into executable so it can be easy and my executable does that math stuff and i think that would be optimistic way.

                    But what i would like to try for now is each button/checkbox or lineedit should run without making my gui unresponsive by using different process. For time being i am trying to ignore heavy calculations and give a try.

                    Can you give some suggestion if this approach seems legit?

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #12

                    @sm2770s
                    So long as you do your computations out-of-process via QProcess::start() your UI will not become unresponsive, provided you use the signals/slots and not QProcess::waitFor...().

                    S 1 Reply Last reply
                    0
                    • A Anonymous_Banned275

                      @sm2770s said in optimizing gui and parralel processing?:

                      @JonB said in optimizing gui and parralel processing?:

                      which you will solve by using signals and slots. If you have heavy Eigen calculations you need to call in the Qt process then you will have to use separate threads if you need to keep the UI responsive.

                      HI Jon! As of now i am planning to move my calculations into executable so it can be easy and my executable does that math stuff and i think that would be optimistic way.

                      But what i would like to try for now is each button/checkbox or lineedit should run without making my gui unresponsive by using different process. For time being i am trying to ignore heavy calculations and give a try.

                      Can you give some suggestion if this approach seems legit?

                      I may be reading this discussion wrong, but...

                      If there is a time consuming task, it does not matter what approach you take - your GUI has to wait until the task returns valid data.
                      Perhaps "blocking (GUI) " is incorrect term to use.
                      Not sure if I agree to try to fool the user that the code is magically working "faster than a speeding bullet".
                      My approach - KISS - I prefer QConnectivity whoops - wrong word - QtConcurrent and I use it to let the user know it is actually taking time to finish the task.
                      Just my opinion.

                      S Offline
                      S Offline
                      sm2770s
                      wrote on last edited by
                      #13

                      @AnneRanch I think blocking GUI is wrong word. I mean what you understood is right!

                      1 Reply Last reply
                      0
                      • JonBJ JonB

                        @sm2770s
                        So long as you do your computations out-of-process via QProcess::start() your UI will not become unresponsive, provided you use the signals/slots and not QProcess::waitFor...().

                        S Offline
                        S Offline
                        sm2770s
                        wrote on last edited by
                        #14

                        @JonB will give a look into what you mentioned . Thanks a lot again :-)

                        1 Reply Last reply
                        0
                        • A Anonymous_Banned275

                          @sm2770s said in optimizing gui and parralel processing?:

                          @JonB said in optimizing gui and parralel processing?:

                          which you will solve by using signals and slots. If you have heavy Eigen calculations you need to call in the Qt process then you will have to use separate threads if you need to keep the UI responsive.

                          HI Jon! As of now i am planning to move my calculations into executable so it can be easy and my executable does that math stuff and i think that would be optimistic way.

                          But what i would like to try for now is each button/checkbox or lineedit should run without making my gui unresponsive by using different process. For time being i am trying to ignore heavy calculations and give a try.

                          Can you give some suggestion if this approach seems legit?

                          I may be reading this discussion wrong, but...

                          If there is a time consuming task, it does not matter what approach you take - your GUI has to wait until the task returns valid data.
                          Perhaps "blocking (GUI) " is incorrect term to use.
                          Not sure if I agree to try to fool the user that the code is magically working "faster than a speeding bullet".
                          My approach - KISS - I prefer QConnectivity whoops - wrong word - QtConcurrent and I use it to let the user know it is actually taking time to finish the task.
                          Just my opinion.

                          JoeCFDJ Offline
                          JoeCFDJ Offline
                          JoeCFD
                          wrote on last edited by
                          #15

                          @AnneRanch Throw any time-consuming job into a thread or a qprocess and add a progress bar to show something is in progress. Keep GUI idle.

                          1 Reply Last reply
                          2

                          • Login

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