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. Busy Cursor in window started by QProcess
Forum Updated to NodeBB v4.3 + New Features

Busy Cursor in window started by QProcess

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 800 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.
  • SamurayHS Offline
    SamurayHS Offline
    SamurayH
    wrote on last edited by SamurayH
    #1

    Hi,
    I'm wondering what could make the cursor of a widget busy for while, if it started using QProcess. For example, let's say that I have a showWidget.exe executable that shows a simple widget like this:

    #include <QApplication>
    #include <QtWidgets/QWidget>
    
    int main(int argc, char *argv[])
    {
       QApplication a(argc, argv);
    
       QWidget w;
       w.show();
    
       return a.exec();
    }
    

    And in an other process I do :

     QProcess p;
     p.start(".../showWidget.exe"); 
     p.waitForFinished(-1);
    

    The shown widget gets a busy cursor for a while. That's it.
    It's not a big issue, but I just want to know if that can be fixed, because if I use the CreateProcess and WaitForSingleObject, win apis, there's no busy cursor.
    Thanks for your help.

    "قال رسول الله صلى الله عليه وسلم : " أحب الناس إلى الله أنفعهم للناس

    aha_1980A 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What do you mean by "in another process" ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • SamurayHS Offline
        SamurayHS Offline
        SamurayH
        wrote on last edited by
        #3

        I mean from an other program. I'm not running that code in showWidget.exe.

        "قال رسول الله صلى الله عليه وسلم : " أحب الناس إلى الله أنفعهم للناس

        1 Reply Last reply
        0
        • SamurayHS SamurayH

          Hi,
          I'm wondering what could make the cursor of a widget busy for while, if it started using QProcess. For example, let's say that I have a showWidget.exe executable that shows a simple widget like this:

          #include <QApplication>
          #include <QtWidgets/QWidget>
          
          int main(int argc, char *argv[])
          {
             QApplication a(argc, argv);
          
             QWidget w;
             w.show();
          
             return a.exec();
          }
          

          And in an other process I do :

           QProcess p;
           p.start(".../showWidget.exe"); 
           p.waitForFinished(-1);
          

          The shown widget gets a busy cursor for a while. That's it.
          It's not a big issue, but I just want to know if that can be fixed, because if I use the CreateProcess and WaitForSingleObject, win apis, there's no busy cursor.
          Thanks for your help.

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @SamurayH

          p.waitForFinished(-1); should only be used in threads. connect a slot to the finished() signal if you don't use threads instead.

          Qt has to stay free or it will die.

          1 Reply Last reply
          2
          • SamurayHS Offline
            SamurayHS Offline
            SamurayH
            wrote on last edited by
            #5

            Solved.
            I didn't know about this. The first time I checked the docs about waitForFinished, it says :
            "This function can operate without an event loop. It is useful when writing non-GUI applications and when performing I/O operations in a non-GUI thread."
            And then I used to do like this :

            int main(int argc, char *argv[])
            {
                QProcess p;
                p.start(".../showWidget.exe"); 
                p.waitForFinished(-1);
                
               if(p.exitCode() != ...)
            //...
            
              return 0;
            }
            

            Thank you very much @aha_1980.

            "قال رسول الله صلى الله عليه وسلم : " أحب الناس إلى الله أنفعهم للناس

            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