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. No SIGNAL from startDetached ?
Qt 6.11 is out! See what's new in the release blog

No SIGNAL from startDetached ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 311 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    Contrary to the documentation the attached code produces desired results, but appears to emit no SIGNALs - I was expecting at least "started'.
    Is is codded correctly ?

        OProcess.startDetached(Command);
        OProcess.waitForFinished();
    
       qDebug(" START int  Form::RunProcess_Asynch(QString Commnd)");
        qDebug() << Command; // TODO Add connect HERE
        ClearTempFile();
        QProcess OProcess;
        connect(&OProcess, &QProcess::errorOccurred, this, &Form::processError);
        //connect(&OProcess, &QProcess::finished(exit)::finished, this, &Form::processFinished);
        //    connect(&OProcess, &QProcess::started, this, &Form::processError);
        connect(&OProcess, &QProcess::started, this, &Form::processStarted);
        // capture any errors (do this before you run the process)
        connect(&OProcess, &QProcess::errorOccurred, this, &Form::processError);
        OProcess.startDetached(Command);
        OProcess.waitForFinished();
        qDebug("END  int  Form::RunProcess_Asynch(QString Commnd)");
    
    JonBJ 1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #2

      @AnneRanch said in No SIGNAL from startDetached ?:

      I was expecting at least "started'.

      This is wrong - otherwise it would not have been called 'detached'
      The documentation is also very clear about it: "Starts the program set by setProgram() with arguments set by setArguments() in a new process, and detaches from it."

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2
      • A Anonymous_Banned275

        Contrary to the documentation the attached code produces desired results, but appears to emit no SIGNALs - I was expecting at least "started'.
        Is is codded correctly ?

            OProcess.startDetached(Command);
            OProcess.waitForFinished();
        
           qDebug(" START int  Form::RunProcess_Asynch(QString Commnd)");
            qDebug() << Command; // TODO Add connect HERE
            ClearTempFile();
            QProcess OProcess;
            connect(&OProcess, &QProcess::errorOccurred, this, &Form::processError);
            //connect(&OProcess, &QProcess::finished(exit)::finished, this, &Form::processFinished);
            //    connect(&OProcess, &QProcess::started, this, &Form::processError);
            connect(&OProcess, &QProcess::started, this, &Form::processStarted);
            // capture any errors (do this before you run the process)
            connect(&OProcess, &QProcess::errorOccurred, this, &Form::processError);
            OProcess.startDetached(Command);
            OProcess.waitForFinished();
            qDebug("END  int  Form::RunProcess_Asynch(QString Commnd)");
        
        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @AnneRanch
        I took the time over at https://forum.qt.io/topic/133498/cannot-get-the-qprocess-started/17 to test and explain that the process.startDetached("hcitool dev>>/tmp/temp") which you believe is working for you is actually not, and is no different from using start() here which also won't work on that string. Did you read it?

        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