Karthik KP Karthik KP - 3 months ago 20
Linux Question

How to show a process result on QT?

I am using QT program test run some background process in Ubuntu.

I know how to display the Qprocess result details after the process is completed.(Using QbyteArray).

Is there any way for me to show the Qprocess progress while the process is running in the background.(ie in message box or any other such informational sub window.)


You can read process output asynchronously. For it you should connect QProcess::readyReadStandardOutput() or QProcess::readyReadStandardError() signal to your slot.

QString program = "ping";
QStringList arguments;
arguments << "google.com";
myProcess = new QProcess(parent);
connect(myProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readyR()));
myProcess->start(program, arguments);

In your slot you can read data from standart output writen by process and do what you want.

void YourClass::readyR()