User Tools

Site Tools


my_debug_output_macro

This is not a criticism of Qt, in fact it has excellent debug output support.

I use Qt Creator and I've always found it slightly frustrating that I can't just click on a line of debug output to be taken to the source line that wrote it.

#define here (qDebug().nospace().noquote() << "file:///" << __FILE__ << ":" << __LINE__ << ":" << __FUNCTION__ << ":").space()

This macro outputs to qDebug as you would expect but outputs the file and line from which the debug output came.

When this is output to the “Application Output” panel in Qt Creator it is parsed in such a way that I can now just click on the line of text in the app output panel and be taken to that line of source.

This is especially useful for cleaning up code before release!!!

my_debug_output_macro.txt · Last modified: 2017/02/09 11:30 by xylene