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

前端 未结 5 444
耶瑟儿~
耶瑟儿~ 2021-02-04 08:47

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

5条回答
  •  深忆病人
    2021-02-04 08:59

    I am on Windows so the killall does not work. But I figured this out (enter the values in the same form that Julien has posted as a screenshot):

    Command: taskkill

    Arguments: /FI "STATUS eq Running" /IM APPNAME.exe /F

    You need to replace APPNAME with your application's name, of course. The /FI "STATUS eq Running" is a filter that enables qmake to proceed after this pre-build-step, even if the application is not yet running (else it would not find the process to kill and then exit). Without the /F the application won't get closed, at least for me.

    However, if your application has a icon in the trayarea, the icon won't disappear. The icon gets removed when you move the mouse over it.

提交回复
热议问题