Commit 4e5e3afc authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

VlmcLogger: Fix build for Qt5

parent bd0edcc0
......@@ -90,7 +90,11 @@ VlmcLogger::~VlmcLogger()
void
VlmcLogger::setup()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
qInstallMessageHandler( VlmcLogger::vlmcMessageHandler );
#else
qInstallMsgHandler( VlmcLogger::vlmcMessageHandler );
#endif
}
void
......@@ -117,8 +121,15 @@ VlmcLogger::writeToFile(const char *msg)
}
void
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
VlmcLogger::vlmcMessageHandler( QtMsgType type, const QMessageLogContext&, const QString& str )
{
const QByteArray byteArray = str.toLocal8Bit();
const char* msg = byteArray.constData();
#else
VlmcLogger::vlmcMessageHandler( QtMsgType type, const char* msg )
{
#endif
//FIXME: This is ok as long as we guarantee no log message will arrive after
// we uninstall the hook
......
......@@ -47,7 +47,11 @@ class VlmcLogger : public QObject, public Singleton<VlmcLogger>
Quiet = QtCriticalMsg
};
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
static void vlmcMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString& str );
#else
static void vlmcMessageHandler( QtMsgType type, const char* msg );
#endif
void setup();
private:
VlmcLogger();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment