In my Qt5 application, I am receiving a log message at run time from Qt itself that looks like this:
QObject::connect: Cannot queue arguments of type 'QHostAddress'
I know how to fix the cause of this message using Q_DECLARE_METATYPE(QHostAddress)
macro or qRegisterMetaType<QHostAddress>("QHostAddress")
class, that is not what this question is about.
What I want to know is, how can I pin-point the exact location of the call in my code that triggered this message?
Since the message does not come with a file/line number and since I seem to be unable to set debugger break-points inside Qt5 itself I can't find out what causes this message.
I create a message handler to catch the messages:
Then in main install the message handler:
Then I set a breakpoint on the warning case. When the breakpoint is hit I walk up the callstack to the line of code that triggered the warning. On some of my applications I have put an assert(false) instead so I don't forget to set the breakpoint.