Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QGraphicsView + QGLWidget setRenderHints not working



  • Hello,

    I'm very new to 2D drawing with Qt. I draw QGraphicsItems (mostly items based on Bezier curves) that are in a QGraphicsScene thanks to a QGraphicsView (such as explained in the documentation). When I set no viewport to this QgraphicsView, using setRenderHints(QPainter::Antialiasing) provides a nice antialiasing on my plots.
    But I need to set the QGraphicsView viewport to be a QGLWidget (because of OpenGL drawing in the background), and when I use setViewport(myQGLWidget), it looks like the setRenderHints() does nothing : no more antialiasing on my plots.

    I tried using setFormat(QGLFormat(QGL::SampleBuffers)) in the QGLWidget, but it does not provide as much possibilities as using the QGraphicsView's setRenderHints method.

    What am I doing wrong ? How can I use QGraphicsView's setRenderHints with a QGLWidget viewport ?

    Thanks.


Log in to reply