I'm new to qt. I'm using qt creator 4.8.1 and am trying to create a gui for a C program that I wrote. The program analyzes files and prints out some information, so my gui would just take that and display it in a text browser. So the idea is once the QProcess prints something I need to read that and display it. I've tried doing it with:
myprocess->waitForReadyRead();
QTextStream(&boxMessage)<<myprocess->readAll();
//display
I've also tried:
connect(myprocess, SIGNAL(readyReadStandardOutput()), this, SLOT(updateProgress()));
//in updateProgress();
QTextStream(&boxMessage1)<<zerosuppProcess->readAllStandardOutput();
The gui does indeed display the messages, but it displays it all at once. To test this out I created a loop with a message printed every second (in my C program) and instead of my gui displaying a new message every second, it displays all of them after 5 seconds (max number of iterations).
So is there a way to know exactly when new messages are available for reading and updating the gui accordingly?
Here is the relevant piece of the C program:
int loopcount = 0;
while (loopcount<5) {
printf("loop #%d\n", loopcount);
loopcount++;
Sleep(1000);
}