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.
-
Yes, the snippet with setSamples() is the correct way to enable 4x antialiasing.
Which platform is this? Windows? Mac?
-
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
-
Okay Thank you very much !
Then i will wait until 5.4.1.Hopefully this includes this patch.
Will this patch also fix the issues with QOpenGLWidget ? Seems that there is only a qtquick file fixed.
-
5.4.1 won't help, it's too late to get any fix in to that.
Also, the QOpenGLWidget issue needs some more investigation. The fixes only cover Qt Quick for now.
-
Could you please create a new Bug Report for QOpenGlWidget and post the link here ?
I Think you can describe the bug better as i do.
-
I've created the Bug Report with a little example.