QOpenGlWidget as viewport of QGraphicsView
-
In my Application i use a QGraphicsView to display several Text(rendered with QGraphicsTextItem) and image items.
I would like to migrate my application to Qt Version 5.4.
With Qt 5.3 i used a QGLWidget as viewport for my graphics view to enable open gl rendering.
Thats simply done by adding the following lines :
@
setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
@What is the correct usage with QOpenGLWidget ?
When i try to set it with :
@
setViewport(new QOpenGLWidget(this));
@everything looks very fuzzy. The Text is rendered too big and thin lines(1 pixel) are not even displayed.
When i use another QSurfaceFormat for my QOpenGLWidget it get a little bit better but i have no idea what are the correct settings.
@
QOpenGLWidget* widget = new QOpenGLWidget(this);
QSurfaceFormat format;
format.setSamples(4);
widget->setFormat(format);
@Can anybody tell me how i have to configure my QOpenGLWidget to have quite the same results as with QGLWidget.
-
The Platform is Mac.
It seems that since Qt 5.4 fonts gets bigger when displaying in an opengl Widget (even with QGLWidget).
Here are three screenshots that show the differences.
Without Open GL :
https://drive.google.com/file/d/0B5fX6ByVLHKDUzAwMU52QkdBaDA/view?usp=sharing
QOpenGLWidget with qt 5.4 :
https://drive.google.com/file/d/0B5fX6ByVLHKDN3NEdC1aMzB2ZTQ/view?usp=sharing
QGLWidget with qt 5.3.2
https://drive.google.com/file/d/0B5fX6ByVLHKDdUdhYWdvMHpOSm8/view?usp=sharing
Is there any other setting than setSamples that could improve antialiasing ?
-
You are most likely seeing https://bugreports.qt.io/browse/QTBUG-42861
-
I've created the Bug Report with a little example.