From 25e7fe16504ad4784ea2d75204ffa855ca6d3e1b Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 14 Feb 2014 15:39:54 +0100 Subject: [PATCH] Fix logging with dynamic GL on Windows category() returns a const QLoggingCategory so our code does not compile anymore. Do it differently. Fix also the Windows error string formatting a bit. Change-Id: Ie0b6b02947d94b7ccf4a4a57da487dfa8a15709d Reviewed-by: Friedemann Kleint --- src/gui/opengl/qopenglproxy_win.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/opengl/qopenglproxy_win.cpp b/src/gui/opengl/qopenglproxy_win.cpp index 04ba794e66..83c3073f63 100644 --- a/src/gui/opengl/qopenglproxy_win.cpp +++ b/src/gui/opengl/qopenglproxy_win.cpp @@ -654,7 +654,7 @@ static QString qgl_windowsErrorMessage(unsigned long errorCode) FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorCode, 0, (LPTSTR)&lpMsgBuf, 0, NULL); if (len) { - rc = QString::fromUtf16(lpMsgBuf, len); + rc += QString::fromUtf16(lpMsgBuf, len); LocalFree(lpMsgBuf); } else { rc += QString::fromLatin1(""); @@ -671,7 +671,7 @@ static HMODULE qgl_loadLib(const char *name, bool warnOnFail = true) if (warnOnFail) { QString msg = qgl_windowsErrorMessage(GetLastError()); - qCWarning(qglLc, "Failed to load %s (%s)", name, qPrintable(msg)); + qCWarning(qglLc, "Failed to load %s: %s", name, qPrintable(msg)); } return 0; @@ -680,9 +680,8 @@ static HMODULE qgl_loadLib(const char *name, bool warnOnFail = true) QWindowsOpenGL::QWindowsOpenGL() : m_eglLib(0) { - qglLc().setEnabled(QtWarningMsg, true); if (qEnvironmentVariableIsSet("QT_OPENGLPROXY_DEBUG")) - qglLc().setEnabled(QtDebugMsg, true); + QLoggingCategory::setFilterRules(QStringLiteral("qt.gui.openglproxy=true")); enum RequestedLib { Unknown,