QProcess m_process;QByteArray p;m_process.start(dump);p = m_process.readAll();ui->textBrowser->append(m_process.readAllStandardOutput());
QByteArray d2;QProcess process; process.start(dump); if (process.waitForFinished() == true) { d2 = process.readAll().data(); textBrowser->insertPlainText(process.readAll().data());
ui->setupUi(this); connect(&mprocess, SIGNAL(readyReadStandardOutput()), this, SLOT(updateOutputTextEdit())); connect(&mprocess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus))); connect(&mprocess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); ss();
void process::ss(){ mprocess.start("Dump");}
void process::updateOutputTextEdit(){ QByteArray newData = mprocess.readAllStandardOutput(); QString text = ui->textEdit->toPlainText() + QString::fromLocal8Bit(newData); ui->textEdit->setPlainText(text);}void process::processFinished(int exitCode, QProcess::ExitStatus exitStatus){ if (exitStatus == QProcess::CrashExit) { ui->textEdit->append(tr("Crash")); } else if (exitCode != 0) { ui->textEdit->append(tr("Faild")); } else { ui->textEdit->append(tr("File create")); }}void process::processError(QProcess::ProcessError error){ if (error == QProcess::FailedToStart) { ui->textEdit->append(tr("Faild to start")); }
QByteArray newData = mprocess.readAllStandardOutput();QString text = ui->textEdit->toPlainText() + QString::fromLocal8Bit(newData);ui->textEdit->setPlainText(text);