PDA

View Full Version : QProcess Problem



pmabie
16th August 2008, 21:24
Hi!
Using CentOS 5.2 , KDevelop 3.5, KDE 3.59


m_Process = new QProcess(this);
connect(m_Process,SIGNAL(readyReadStandardOutput() ), this,SLOT(ProcessLine()));
m_Process->setProcessChannelMode(QProcess::ForwardedChannels) ;
m_Process->exec(app,args);
if (m_Process->waitForFinished())
return;

My Program is a simple wrapper for p7Zip, I got everything to work except the progressbar, I read in the docs that QProcess::exec forwords the output of the child process to the main process.

How do I get this info .

ps: I did try (this) in the connect function , but the output on the compiler window told me that there was no signal by that name.

Thanks for your help!
Patrick.

jacek
16th August 2008, 21:36
if (m_Process->waitForFinished())
If you will wait for the process here, your GUI won't work, because you will block the event loop. Better connect to the finished() signal.


I did try (this) in the connect function , but the output on the compiler window told me that there was no signal by that name.
How did you declare ProcessLine slot?

pmabie
17th August 2008, 04:16
public slot

jacek
17th August 2008, 14:04
Did you remember about Q_OBJECT macro?

pmabie
17th August 2008, 17:44
it's in my class .
Patrick.

jacek
17th August 2008, 23:21
Could you post the exact error message? Maybe there's a typo in slot name?

pmabie
18th August 2008, 03:32
Sure will .
Patrick.

pmabie
18th August 2008, 06:06
here's my problem , can I get the Standard out that is being sent to my program from the QProcess?

Thanks.

jacek
19th August 2008, 00:40
When you make that ProcessLine() slot work, you can use QProcess::readAll() or QProcess::readLine().