Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- InterProcess::InterProcess(QObject *parent) : QProcess(parent)
- {
- process = new QProcess(this);
- process->start(myChildApp);
- process->waitForStarted();
- process->setCurrentWriteChannel(QProcess::StandardOutput);
- process->write("Test");
- connect( process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(error(QProcess::ProcessError)) );
- connect( process, SIGNAL(readyReadStandardError()), this, SLOT(readyReadStandardError()) );
- connect( process, SIGNAL(readyReadStandardOutput()), this, SLOT(readyReadStandardOutput()) );
- QByteArray InterProcess::read()
- {
- QByteArray readBuffer = process->readAllStandardOutput();
- return readBuffer;
- }
- void InterProcess::error( QProcess::ProcessError error )
- {
- qDebug() << "Error!";
- qDebug() << error;
- }
- void InterProcess::readyReadStandardError()
- {
- qDebug() << "Ready to read error.";
- qDebug() << process->readAllStandardError();
- }
- void InterProcess::readyReadStandardOutput()
- {
- qDebug() << "The output:";
- QByteArray readBuffer = process->readAllStandardOutput();
- qDebug() << readBuffer;
- }
- InterProcess::InterProcess(QObject *parent) : QProcess(parent)
- {
- process = new QProcess();
- process->setCurrentReadChannel(QProcess::StandardOutput);
- connect( process, SIGNAL(readyRead()), this, SLOT(readyReadStandardOutput()));
- connect( process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(error(QProcess::ProcessError)) );
- connect( process, SIGNAL(readyReadStandardError()), this, SLOT(readyReadStandardError()) );
- connect( process, SIGNAL(readyReadStandardOutput()), this, SLOT(readyReadStandardOutput()) );
- process->waitForReadyRead(5000);
- }
- void InterProcess::readyReadStandardError()
- {
- qDebug() << "Ready to read error.";
- qDebug() << process->readAllStandardError();
- setText("REady error");
- }
- void InterProcess::readyReadStandardOutput()
- {
- setMessage("2");
- qDebug() << "The output:";
- QByteArray readBuffer = process->readAllStandardOutput();
- qDebug() << readBuffer;
- }
- void InterProcess::error( QProcess::ProcessError error )
- {
- qDebug() << "Error!";
- qDebug() << error;
- setText(QString(error));
- }
Add Comment
Please, Sign In to add comment