stateChanged(): QProcess::ProcessState(Starting)stateChanged(): QProcess::ProcessState(Running)started()errorOccurred(): QProcess::ProcessError(Crashed)stateChanged(): QProcess::ProcessState(NotRunning)finished(): -1073741515 QProcess::ExitStatus(CrashExit)
#include "work.h"#include <QDebug>#include <QTextStream>Work::Work(){ myProcess = new QProcess(); connect(myProcess, SIGNAL(started()), this, SLOT(started())); connect(myProcess, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(errorOccurred(QProcess::ProcessError))); connect(myProcess, SIGNAL(readyReadStandardError()), this, SLOT(readyReadStandardError())); connect(myProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput())); connect(myProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(finished(int, QProcess::ExitStatus))); connect(myProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(stateChanged(QProcess::ProcessState))); createProcess1();}void Work::createProcess1(){ QString program = "d:\\opt\\ms\\bin\\ms.exe --version"; myProcess->start(program); myProcess->waitForStarted(3000); myProcess->waitForReadyRead(3000); myProcess->waitForFinished(100);}void Work::finished(int exitCode, QProcess::ExitStatus exitStatus){ qDebug() << "finished(): " << exitCode << exitStatus;}void Work::readStandardOutput(){ qDebug() << "readStandardOutput(): " << myProcess->readAllStandardOutput();}void Work::readyReadStandardError(){ qDebug() << "readyReadStandardError(): " << myProcess->errorString();}// http://doc.crossplatform.ru/qt/4.7.x/qprocess.htmlvoid Work::errorOccurred(QProcess::ProcessError error){ qDebug() << "errorOccurred(): " << error;}void Work::started(){ qDebug() << "started()";}void Work::stateChanged(QProcess::ProcessState newState){ qDebug() << "stateChanged(): " << newState;}