[Qt-interest] problem in QProcess
chandrasekar wagmare
sekarwagmare at gmail.com
Sat Jan 3 12:08:16 CET 2009
hi friends,
please help
i create a code to embed gtk window to my Qt app ..
*mainwindow.cpp*
procc2 = new QProcess<http://doc.trolltech.com/latest/QProcess.html>
();
procc2->setProcessChannelMode(QProcess
<http://doc.trolltech.com/latest/QProcess.html>::MergedChannels);
connect(procc2, SIGNAL(readyReadStandardOutput()), this,
SLOT(readFromStdout2()));
*this is a timer function calling every 400 milli sec
*
MainWindow::timeout{
if(...)
{
QString <http://doc.trolltech.com/latest/QString.html> program4 =
"./gtk_demo2";
QStringList <http://doc.trolltech.com/latest/QStringList.html> arguments2;
if(procc2->state() != QProcess
<http://doc.trolltech.com/latest/QProcess.html>::Running)
{
procc2->start(program4, arguments2);
}
}*
**readfromstdout() function will call the function to embed the process
*MainWindow::readFromStdout2()
{
int j = 0;
bool ok;
QString <http://doc.trolltech.com/latest/QString.html> out;
printf("in singal fin\n");
out = procc2->readAllStandardOutput();
j = out.toInt(&ok, 16);
printf("j =%d\n",j);
if(j == 1)
printf("device not connected\n");
else{
printf("the device connected\n");
embed();
}
}
* *
this is my code and the function embed() will embed the *"gtk_demo"* window
if it returns 0 or anything ...
the problem is on first time if i spawn the signal *
"readyReadStandardOutput()"*
is not emitted and readFromStdout2() slot is not called .
i closed the spawned gtk application *"gtk_demo"* and as i put the procc in
loop again it spawn *"gtk_demo"* its emitting
*"readyReadStandardOutput()"*and embedding perfectly ... why??
only after closing the process started window i can get the std
output
please help me ...
--
CHANDRU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090103/cf96ac8f/attachment.html
More information about the Qt-interest-old
mailing list