// only windows has a "default" msg handler, 0 is returned on other platforms!
QtMsgHandler msgHandler = qInstallMsgHandler(myMsgHandler);
void myMsgHandler(QtMsgType type , const char *msg)
{
...
if (QThread::currentThread() == qApp
->thread
()) {
// gui thread
}
if (msgHandler)
{
// call the default windows handler
msgHandler(type, msg);
}
else
{
fprintf(stderr, qPrintable(text));
}
...
}
// only windows has a "default" msg handler, 0 is returned on other platforms!
QtMsgHandler msgHandler = qInstallMsgHandler(myMsgHandler);
void myMsgHandler(QtMsgType type , const char *msg)
{
...
if (QThread::currentThread() == qApp->thread())
{
// gui thread
}
if (msgHandler)
{
// call the default windows handler
msgHandler(type, msg);
}
else
{
fprintf(stderr, qPrintable(text));
}
...
}
To copy to clipboard, switch view to plain text mode
Bookmarks