Windows 8.1 not repainting QGLWidget when using high contrast theme



  • Repaints happen only if window is resized or moved outside desktop.
    Tested on Qt 4.8.6/5.4.0 minGW/MSVC

    main.cpp:
    @#include <QApplication>
    #include "glwidget.h"

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    GLWidget w;
    w.show();
    return a.exec();
    }@

    glwidget.h:
    @#ifndef GLWIDGET_H
    #define GLWIDGET_H

    #include <QGLWidget>
    #include <QTime>

    class GLWidget : public QGLWidget
    {
    Q_OBJECT
    public:
    GLWidget() : QGLWidget() {}
    private:
    GLclampf R() { return GLclampf(rand() % 255) / 255; }
    protected:
    void mousePressEvent(QMouseEvent *e) {
    qDebug("\nMouse clicked. Going to repaint...");

        update();
        //updateGL();
    }
    void paintGL() {
        glClearColor(R(), R(), R(), 1.0);
        glClear(GL_COLOR_BUFFER_BIT);
    
        qDebug("repainted " + QTime::currentTime().toString().toAscii());
    }
    

    };

    #endif // GLWIDGET_H@

    saw same strangeness on Linux with AMD's proprietary drivers.

    rebooted 10 times after changing appereance theme ;)


  • Moderators

    Hi, and welcome to the Qt Dev Net!

    QGLWidget has multiple known issues, and it has been deprecated in Qt 5.4.

    Please use "QOpenGLWidget":http://doc.qt.io/qt-5/qopenglwidget.html instead.



  • Thankx for answer&welcomes
    Moving to QOpenGLWidget doesnt solve the problem.

    hellogl2 example from Qt 5.4 also doesnt show anything till I set:
    @QSurfaceFormat fmt;
    ...
    fmt.setSwapBehavior(QSurfaceFormat::SingleBuffer);
    QSurfaceFormat::setDefaultFormat(fmt);@



  • Seems that problem is Qt-independent
    Almost all OpenGL apps using double buffer doent show anything


Log in to reply