Quote Originally Posted by Yes View Post
. . . but now I wanted to use the stateChanged signal. . . .
Then connecting both signals should work:
Qt Code:
  1. process_handler::process_handler(QObject *parent) :
  2. QObject(parent)
  3. {
  4. connect(&p, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(process_state_changed(QProcess::ProcessState)));
  5. connect(&p, SIGNAL(finished()), this, SLOT(start_process()));
  6. }
  7.  
  8. void process_handler::process_state_changed(QProcess::ProcessState state)
  9. {
  10. if (state == QProcess::Starting) {
  11. cout << endl;
  12. cout << "Process is starting up..." << endl;
  13. }
  14. if (state == QProcess::Running) {
  15. cout << "Process is now running." << endl;
  16. }
  17. if (state == QProcess::NotRunning) {
  18. cout << "Process is finished running." << endl;
  19.  
  20. /* Start a new process */
  21. // start_process();
  22. //QTimer::singleShot(0, this, SLOT(start_process()));
  23. }
  24. }
  25.  
  26. . . .
To copy to clipboard, switch view to plain text mode