Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you configure Qt Creator to kill the running application before building or running?

Tags:

qt-creator

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?

like image 882
Cory Klein Avatar asked Feb 19 '13 17:02

Cory Klein


People also ask

How do I create an executable in the custom run configuration QT?

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.

Is Qtcreator an IDE?

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.


2 Answers

There is an option to do that in Qt Creator:

  1. Open the Preferences => Build & Run => General
  2. Change “Stop application before building” from “None” to “Same Project”
like image 159
bpierre Avatar answered Sep 20 '22 22:09

bpierre


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

like image 34
igorrafael Avatar answered Sep 20 '22 22:09

igorrafael