I\'m developing a QApplication and I find that I often forget to close my application before rebuilding and re-running it. This becomes a problem when I accidentally look at an
Yes.
One way is to create a very simple script that kills your existing running process and starts a new one. If your program executable is FooBarProgram then go to the build directory that Qt has created and create this file FooBarProgramLauncher
#!/bin/bash
killall FooBarProgram
./FooBarProgram
Now change the Qt project configuration to run your launcher instead running your program directly:
FooBarProgramLauncherNow whenever you tell Qt to run your program it will run FooBarProgramLauncher instead which in turn will kill any running instances of FooBarProgram and then run the newly compiled executable.