Subclassing QDebug to get rid of the NewLine of QDebug() function ?
Does anyone here have even tried to subclass QDebug in a way that it does not send a Line Feel (“\n”) when it is destroyed? Is there a virtual function to reimplement in order to easily do it.
Thanks in advance
PS : I know I could use std::cout, but it does not display Qt Classes
Instead of subclassing QDebug you can call qInstallMsgHandler(someHandlerFunc) and then chop the offending newline character in this handler and output it to wherever you want.
This way you have full control over what and where is outputted but you get to keep the nice QDebug formatting.
Thanks Krzystof. That's exactly what i needed.
Adding in the message handler this :
std::cout << msg;
gave me the behavior i was looking for.