Does anyone know an officially supported way to include debug-build only code in Qt? For example:
#ifdef QT_DEBUG
// do something
#endif
Basically like Q_ASSERT but for more complex tests.
I can't seem to find any documentation which says that the Qt framework guarantees to define a debug macro. If there isn't, what would be a sensible unofficial way to implement this feature project wide?
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
.