View Single Post
Copernicus's Avatar
Posts: 1,986 | Thanked: 7,698 times | Joined on Dec 2010 @ Dayton, Ohio
#9
Originally Posted by marxian View Post
Your old approach didn't work because the QProcess object fell out of scope.
Ah! So a "StartDetached()" call would work in that case, allowing the script to continue after the QProcess object is destroyed.

Actually, this also means you don't really need the "kill.sh" script to stop the process (unless kill.sh does something special). A call to "terminate()" (or just destroying the object) should do the trick...

EDIT: As Marxian notes below, you can't call "terminate()" on a destroyed QProcess object. (In short, you'd need to have a QProcess object that lives beyond the start_clicked() method, call "start()" (not "startDetached()") on it in that method, and call "terminate()" in the stop_clicked() method...)

Last edited by Copernicus; 2012-10-20 at 00:01. Reason: Edit: oops, thanks for Marxian fix
 

The Following 2 Users Say Thank You to Copernicus For This Useful Post: