简体   繁体   中英

when closing the qt application, want to kill qprocess

in my mainwindow.cpp, inside the constructor, I started a qprocess so the process(.exe) runs when I open the qt application.

Now I want to kill/close the qprocess when I close the qt application. How can I do it?

See the documentation for QProcess::terminate and QProcess::kill . They each have slightly different behavior. Use terminate to give the process a chance to shut down gracefully. Use kill to kill it more forcefully. In the case of terminate , you probably want to wait until the child process has finished (eg QProcess::waitForFinished ) before exiting the parent process.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM