PDA

View Full Version : Is it possible to know if a application is running on debug or release inside QML?



ricardodovalle
7th April 2014, 06:12
At Qt/C++ there is QT_DEBUG define macro to know when it is compiled at debug or release, but at QML, is there any method to know if is the application running in debug o release mode?

Thanks,

anda_skoa
7th April 2014, 10:03
You could export that as a context property.

Any specific reason why the QML code needs to know whether the C++ part is built in debug or release mode?

Cheers,
_

ricardodovalle
7th April 2014, 17:34
Because I want to hide some buttons and configurations from release mode.

Thanks for your answer. Context property solved.




#ifdef QT_DEBUG
viewer.rootContext()->setContextProperty("debug", true);
#else
viewer.rootContext()->setContextProperty("debug", false);
#endif



You could export that as a context property.

Any specific reason why the QML code needs to know whether the C++ part is built in debug or release mode?

Cheers,
_