Qt: QGLShaderProgram turn off log messages

Is there a way to turn of log messages when calling QGLShaderProgram::link()? http://qt-project.org/doc/qt-4.8/qglshaderprogram.html#link

Messages look like:

QGLShader::link: "Vertex shader(s) linked, fragment shader(s) linked.
"

Qt code looks like this: src/opengl/qglshaderprogram.cpp:893

    glLinkProgram(program);
    value = 0;
    glGetProgramiv(program, GL_LINK_STATUS, &value);
    d->linked = (value != 0);
    value = 0;
    glGetProgramiv(program, GL_INFO_LOG_LENGTH, &value);
    d->log = QString();
    if (value > 1) {
        char *logbuf = new char [value];
        GLint len;
        glGetProgramInfoLog(program, value, &len, logbuf);
        d->log = QString::fromLatin1(logbuf);
        QString name = objectName();
        if (name.isEmpty())
            qWarning() << "QGLShader::link:" << d->log;
        else
            qWarning() << "QGLShader::link[" << name << "]:" << d->log;
        delete [] logbuf;
    }
    return d->linked;
}

Answers


So it seems the only possible solution is to redirect qWarning() as done in: How to redirect qDebug, qWarning, qCritical etc output?

 qInstallMsgHandler([](QtMsgType , const char* ) { });  // empty message handler
 bool result = program.link();
 qInstallMsgHandler(0);  // restore default message handling

Need Your Help

How to get friendly device name from DEV_BROADCAST_DEVICEINTERFACE and Device Instance ID

c# winapi guid device-instance-id

I've registered a window with RegisterDeviceNotification and can successfully recieve DEV_BROADCAST_DEVICEINTERFACE messages. However, the dbcc_name field in the returned struct is always empty. The

SearchView expand throws null pointer exception

android nullpointerexception android-actionbar android-4.0-ice-cream-sandwich

I am testing application in Samsung Galaxy Tab (P7500) (android 4.0.4) and I am get this error on trying expand default SearchView widget in action bar. Before 4.0.4 update my application works ver...