Does anyone know an officially supported way to include debug-build only code in Qt? For example:
#ifdef QT_DEBUG
// do something
#endif
Basica
For check debug mode:
#ifdef QT_DEBUG
//Some codes
#endif
For check release mode:
#ifndef QT_DEBUG //<== Please note... if not defined
//Some codes
#endif
Qt defines QT_NO_DEBUG for release builds. Otherwise QT_DEBUG is defined.
Of course you are free to specify any DEFINES in your .pro files and scope them for either debug or release.
An alternative is to write in your project file something like:
debug {
DEFINES += MYPREFIX_DEBUG
}
release {
DEFINES += MYPREFIX_RELEASE
}
Then you will not depend on the Qt internal definition.