On 06/03/16 08:47, Walter Stefan wrote:
Hi,

I would like to determine in my application, if it was started through
Qt Creator.

My code should behave slightly different between running from Qt-Creator
(error handling) or started directly from a terminal.

What is the best approach for this?

In the project settings, you can modify the environment. Choose the "run" configuration, and just add an environment variable. Name it whatever you want, like IN_QTCREATOR.

In your program, just use:

  qEnvironmentVariableIsSet("IN_QTCREATOR");

(http://doc.qt.io/qt-5/qtglobal.html#qEnvironmentVariableIsSet)

to detect if the variable is set. Obviously, it only going to be set if you run the program in Creator.


_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qt-creator

Reply via email to