I have a script which echos "Hello world" 5 times on the console with an interval on 1 sec. When i use the same script in Qt, the behavior is not the same.
QProcess *process = new QProcess;
//Step1 - create a new process
process->start("/bin/sh", QStringList()<< "pathtoscript.sh");
process->waitForFinished();
// Step2 - display the script output on text browser
ui->textBrowser->setText(process->readAllStandardOutput());
If I don't use "process->waitForFinished()", the application doesn't show any output in textBrowser, howsover using the same block call, I can see the o/p on console but the problem is its not dynamic. It should print "Helloworld" sleep for 1 sec and again follow the same behavior. But with this code i get the o/p on console in the end, All the "Helloworld" prints togather not one by one.
What should I look into?