Originally Posted by
Yes
. . . but now I wanted to use the stateChanged signal. . . .
Then connecting both signals should work:
process_handler
::process_handler(QObject *parent
) :{
connect(&p,
SIGNAL(stateChanged
(QProcess::ProcessState)),
this,
SLOT(process_state_changed
(QProcess::ProcessState)));
connect(&p, SIGNAL(finished()), this, SLOT(start_process()));
}
void process_handler
::process_state_changed(QProcess::ProcessState state
) {
cout << endl;
cout << "Process is starting up..." << endl;
}
cout << "Process is now running." << endl;
}
cout << "Process is finished running." << endl;
/* Start a new process */
// start_process();
//QTimer::singleShot(0, this, SLOT(start_process()));
}
}
. . .
process_handler::process_handler(QObject *parent) :
QObject(parent)
{
connect(&p, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(process_state_changed(QProcess::ProcessState)));
connect(&p, SIGNAL(finished()), this, SLOT(start_process()));
}
void process_handler::process_state_changed(QProcess::ProcessState state)
{
if (state == QProcess::Starting) {
cout << endl;
cout << "Process is starting up..." << endl;
}
if (state == QProcess::Running) {
cout << "Process is now running." << endl;
}
if (state == QProcess::NotRunning) {
cout << "Process is finished running." << endl;
/* Start a new process */
// start_process();
//QTimer::singleShot(0, this, SLOT(start_process()));
}
}
. . .
To copy to clipboard, switch view to plain text mode
Bookmarks