[KDE-India] help with process in QT

Prashanth Udupa prashanth.udupa at gmail.com
Sat Jan 26 21:16:37 CET 2008


Hi,

How do I get the output of the process. I tried all ways possible but
> still its not showing any output.


I assume that you are using Qt 4.x. The QProcess class has signals
"readyReadStandardError" and "readyReadStandardOutput". These signals are
emitted when there is any output written by the managed process into the
stderr or stdout streams. You can connect these signals to some slot and
then fetch the output from QProcess. Example

void MyClass::slotOutputAvailable()
{
  QProcess* p = qobject_cast<QProcess*>( sender() );
  QString stdoutString = p->readAllStandardOutput();
  QString stderrString = p->readAllStandardError();
  // ...........
  qDebug( "%s", qPrintable(stdoutString) );
}

Hope this helps.

/ Prashanth

-- 
Thanks and Warm Regards,
Prashanth N Udupa
    EMail:      prashanth.udupa at gmail.com
    Website: http://www.prashanthudupa.com
    LJ: http://prashanthudupa.livejournal.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-india/attachments/20080127/8296e753/attachment.html 


More information about the KDE-india mailing list