Thanks, but is there not a more generic way. I don't want to set this in every single project.
Regards, Stefan -----Original Message----- From: Qt-creator [mailto:[email protected]] On Behalf Of Nikos Chantziaras Sent: Sonntag, 6. März 2016 14:06 To: [email protected] Subject: Re: [Qt-creator] Determine if started through Qt Creator 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 _______________________________________________ Qt-creator mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/qt-creator
