Important: Please read the Qt Code of Conduct -

Flicker when sliding QSplitter with QGraphicsView(viewport QGLWidget)

  • Hello,

    I am using QGraphicsView with the viewport as QGLWidget.
    QGraphicsView and a QTreeView are added to a QSplitter.
    Sliding the QSplitter results in flickering/non-repainting/weird behaviour on the QGraphicsView.

    Adding QGLWidget without QGraphicsView to the QSplitter works as expected.

    The following code demonstrates Flickering with QGraphicsView, and no flickering without QGraphicsView when sliding the QSplitter.

    @#include <QtGui>
    #include <QGLWidget>
    #include <QtWidgets>

    int main(int argc, char **argv)
    QApplication app(argc, argv);

    // Flickering occurs when sliding a QSplitter with QGraphicsView (viewport QGLWidget).
    QGraphicsView *view = new QGraphicsView();
    view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
    view->setScene(new QGraphicsScene);
    QSplitter *graphicsViewSplitter = new QSplitter();
    graphicsViewSplitter->addWidget(new QTreeView());
    // This works ok with a normal QGLWidget added to a QSplitter.
    QSplitter *openGlSplitter = new QSplitter();
    openGlSplitter->addWidget(new QTreeView());
    openGlSplitter->addWidget(new QGLWidget());
    return app.exec&#40;&#41;;


    Is there a fix for this?


Log in to reply