hi friends,
please help
i create a code to embed gtk window to my Qt app ..
mainwindow.cpp
Qt Code:
  1. procc2 = new QProcess();
  2. procc2->setProcessChannelMode(QProcess::MergedChannels);
  3. connect(procc2, SIGNAL(readyReadStandardOutput()), this, SLOT(readFromStdout2()));
To copy to clipboard, switch view to plain text mode 

this is a timer function calling every 400 milli sec
Qt Code:
  1. MainWindow::timeout{
  2. if(...)
  3. {
  4. QString program4 = "./gtk_demo2";
  5. QStringList arguments2;
  6. if(procc2->state() != QProcess::Running)
  7. {
  8. procc2->start(program4, arguments2);
  9. }
  10. }
To copy to clipboard, switch view to plain text mode 

readfromstdout() function will call the function to embed the process
Qt Code:
  1. MainWindow::readFromStdout2()
  2. {
  3. int j = 0;
  4. bool ok;
  5. QString out;
  6. printf("in singal fin\n");
  7. out = procc2->readAllStandardOutput();
  8. j = out.toInt(&ok, 16);
  9. printf("j =%d\n",j);
  10. if(j == 1)
  11. printf("device not connected\n");
  12. else{
  13. printf("the device connected\n");
  14. embed();
  15. }
  16.  
  17. }
To copy to clipboard, switch view to plain text mode 

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??
i changed gtk application to a Qt application and try the same thing its worked in the first attempt ...

please help me ...