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?
Moving Breakpoints To move a breakpoint: Drag and drop a breakpoint marker to another line in the text editor. In the Breakpoint Preset view or the Breakpoints view, select Edit Selected Breakpoints, and set the line number in the Line number field.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With