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 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.
Code:
#include <QtGui>
#include <QGLWidget>
#include <QtWidgets>
int main(int argc, char **argv)
{
// Flickering occurs when sliding a QSplitter with QGraphicsView (viewport QGLWidget).
graphicsViewSplitter
->addWidget
(new QTreeView());
graphicsViewSplitter->addWidget(view);
graphicsViewSplitter->show();
// This works ok with a normal QGLWidget added to a QSplitter.
openGlSplitter->show();
return app.exec();
}
Is there a fix for this?
Thanks
Re: Flicker when sliding QSplitter with QGraphicsView(viewport QGLWidget)
Should I report as a bug?
Re: Flicker when sliding QSplitter with QGraphicsView(viewport QGLWidget)
Your two cases are different, and I doubt the splitter has anything to do with it. Do the same app, except use a single QGraphicsView or QGLWidget as the central widget of a QMainWindow and no splitter. Resize the window and see if you still get flicker.
If so, then it will come down to the differences between what you are displaying. In the first case, you have a graphics view with a scene and a QGLWidget created with a specific QGLFormat as viewport. In the second case, you have only a default constructed QGLWidget. The default QGLFormat format may not be the same as the one you specified int he first case.
It is very, very rare for something so obvious to be a Qt bug. It is almost always a programmer bug instead.
Re: Flicker when sliding QSplitter with QGraphicsView(viewport QGLWidget)
Quote:
Originally Posted by
d_stranz
Your two cases are different, and I doubt the splitter has anything to do with it. Do the same app, except use a single QGraphicsView or QGLWidget as the central widget of a QMainWindow and no splitter. Resize the window and see if you still get flicker.
If so, then it will come down to the differences between what you are displaying. In the first case, you have a graphics view with a scene and a QGLWidget created with a specific QGLFormat as viewport. In the second case, you have only a default constructed QGLWidget. The default QGLFormat format may not be the same as the one you specified int he first case.
It is very, very rare for something so obvious to be a Qt bug. It is almost always a programmer bug instead.
Hello d_stranz,
QGraphicsView with QGLWidget viewport in normal window is fine.
QGraphicsView with QGLWidget viewport added to QSplitter has weird behavior when sliding the QSplitter (and resizing the window).
QGLWidget added to QSplitter is fine.
QGraphicsView (without QGLWidget viewport) added to QSplitter is fine.
Code:
graphicsViewSplitter
->addWidget
(new QTreeView());
graphicsViewSplitter->addWidget(view);
graphicsViewSplitter->show();
Thanks
Added after 26 minutes:
It was a bug that has been fixed in 5.4
https://bugreports.qt.io/browse/QTBUG-38327
Re: Flicker when sliding QSplitter with QGraphicsView(viewport QGLWidget)
Quote:
It was a bug that has been fixed in 5.4
Hah! Well, I will go and eat my humble pie now.