Getting QProcess to send Signals...

  • I have created a QWizardPage class, which has the following code in its constructor:

        Process = new QProcess(this);
        connect(Process, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(onRunning(QProcess::ProcessState)));
        connect(Process, SIGNAL(readyReadStandardOutput()), this, SLOT(onOutput()));
        connect(Process, SIGNAL(readyReadStandardError()), this, SLOT(onError()));

    I have overriden the QWizardPage::initializePage() function and the code of my version of this function includes the following line:


    where Command is QString that represents what should be executed. I see that this execution does take place and it does produce some text on stdout. However, none of the signals QProcess::stateChanged(QProcess::ProcessState), QProcess::readyReadStandardOutput() and QProcess::readyReadStandardError() get triggered as the slots in my QWizardPage to which these signals are connected do not get executed when the Command is executed. Is there anything that I should do to activate the signalling or so?

  • Lifetime Qt Champion


    startDetached is a static method thus it doesn't use the Process object at all. Use start if you want to get something from your process.

  • Great! That solved it. Wasn't aware that startDetached is static...

  • Lifetime Qt Champion

    Well, the method documentation as well as QProcess's list of static methods are pretty clear.

    However, with Qt 5.10, there will be a new version of that method.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.