PDA

View Full Version : problem with QProcess in Qt4



kennyxing
20th October 2006, 02:03
Basically I try to start a process and print the output on a QTextEdit.

I connect process.readyRead() signal to a slot in which I call process.readAll() to get the output. For some processes, such as "cmd.exe",I successfully get the output; but in the others, such as the "make" utility used in compiling Qt codes, I cannot get any output.

Can anyone tell me the reason, and how to solve this problem?

e8johan
20th October 2006, 06:43
Does make emit text to stdout or stderr?

kennyxing
20th October 2006, 06:47
Does make emit text to stdout or stderr?

I use Qt::connect(&process,SIGNAL(readyRead()),this,SLOT(showText())) , and in showText() I use process.readAll().

fullmetalcoder
20th October 2006, 08:08
I use Qt::connect(&process,SIGNAL(readyRead()),this,SLOT(showText())) , and in showText() I use process.readAll().
Really? Then make shouldn't cause any trouble... That's the way Edyuk recieve output from compilation and no problem has ever occured on any platform...

kennyxing
20th October 2006, 09:07
Really? Then make shouldn't cause any trouble... That's the way Edyuk recieve output from compilation and no problem has ever occured on any platform...

The following is pretty much the code. Can you take a look at it?

{
process.setWorkingDirectory(file.absolutePath());
QObject::connect(&process,SIGNAL(readyReadStandardOutput()),
this,SLOT(output()));
QObject::connect(&process,SIGNAL(readyReadStandardError()),
this,SLOT(output()));
process.start("make");
}

The output() slot is:


output(){
out.append(QString(process.readAllStandardOutput() ));
out.append(QString(process.readAllStandardError()) );
}