From 524ee4a679987c3514d89c592289be4773747a62 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 5 Jan 2017 14:24:03 +0100 Subject: [PATCH] fix Qt5 port of messageHandler --- src/Gui/Application.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 2543ad72b..797e0c011 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -1279,10 +1279,9 @@ typedef void (*_qt_msg_handler_old)(QtMsgType type, const char *msg); _qt_msg_handler_old old_qtmsg_handler = 0; #if QT_VERSION >= 0x050000 -void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &qmsg) +void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { Q_UNUSED(context); - const QChar *msg = qmsg.unicode(); #ifdef FC_DEBUG switch (type) { @@ -1290,26 +1289,26 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QSt case QtInfoMsg: #endif case QtDebugMsg: - Base::Console().Message("%s\n", msg); + Base::Console().Message("%s\n", msg.toUtf8().constData()); break; case QtWarningMsg: - Base::Console().Warning("%s\n", msg); + Base::Console().Warning("%s\n", msg.toUtf8().constData()); break; case QtCriticalMsg: - Base::Console().Error("%s\n", msg); + Base::Console().Error("%s\n", msg.toUtf8().constData()); break; case QtFatalMsg: - Base::Console().Error("%s\n", msg); + Base::Console().Error("%s\n", msg.toUtf8().constData()); abort(); // deliberately core dump } #ifdef FC_OS_WIN32 if (old_qtmsg_handler) - (*old_qtmsg_handler)(type, context, qmsg); + (*old_qtmsg_handler)(type, context, msg); #endif #else // do not stress user with Qt internals but write to log file if enabled Q_UNUSED(type); - Base::Console().Log("%s\n", msg); + Base::Console().Log("%s\n", msg.toUtf8().constData()); #endif } #else