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 instance of my application built 10 minutes ago and expect to see code changes from 30 seconds ago.
It is also annoying because I have to move my hand all the way over to the mouse, move the mouse all the way over to the running application, and close it every time I want to rebuild and I am lazy and I don't want to do that.
Is it possible to configure Qt Creator to close my QApplication when I start building or running it again?
If you want to run some other Python file than main.py , create a custom executable run configuration: Select Add > Custom Executable. In the Executable field, specify the path to the Python executable. In the Command line arguments field, select the Python file to run.
Qt Creator is a cross-platform integrated development environment (IDE) built for the maximum developer experience. Qt Creator runs on Windows, Linux, and macOS desktop operating systems and allows developers to create software across desktop, mobile, and embedded platforms.
There is an option to do that in Qt Creator:
To whomever might stumble here later, an easier way to o this is to put a "killall" command (as suggested by tangbongbong) is the first build step under Projects(ctrl+5) -> Build and Run
In the screenshot below my executable name was "Tutano" and I added the -9 option to ensure it would be killed.
Screenshot - sorry, I'm new here so can't post an image directly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With