You can kill or terminate the process explicitly depending on your desire. That is, however, not enough on its own because you actually need to wait for the process to terminate. "kill" means it will send the SIGKILL signal on Unix to the process and that also takes a bit of time to actually finish.
Therefore, you would be writing something like this:
main.cpp
#include <QProcess>
int main()
{
QProcess p;
p.start("sleep 10");
p.waitForBytesWritten();
if (!p.waitForFinished(1)) {
p.kill();
p.waitForFinished(1);
}
return 0;
}
main.pro
TEMPLATE = app
TARGET = main
QT = core
SOURCES += main.cpp