I am currently working on a project with Qt5.4 and C++. In this project I start and stop Processes with the QProcess class.
I am now extending the project to start batch files. The Problem is that I want to terminate/kill the processes started with the batch file, using the QProcess. Calling terminate does not work (or maybe I am calling it wrong)
edit: QProcess is a Member(pointer) of a class called ProcessHolder. startProcess() and stopProcess() handle the process.
bool ProcessHolder::startProcess(const QString &path,
const QStringList &args) {
process_->start(path, args);
qDebug() << process_->errorString();
if(process_->waitForStarted(1000)) {
state_ = ProcessState::running;
return true;
} else {
state_ = ProcessState::fail;
return false;
}
}
bool ProcessHolder::stopProcess() {
process_->terminate();
state_ = ProcessState::notRunning;
return true;
}
Please help me, Ben