[Interest] Poor retina support for QGraphicsView on macOS?

Christian Gagneraud chgans at gmail.com
Sat Oct 7 10:09:31 CEST 2017


On 7 October 2017 at 16:11, Patrick Stinson <patrickkidd at gmail.com> wrote:
>
> Hello!
>
> I am seeing the antialiasing is still quite grainy using a QGraphicsView on mac. Is it possible to increase the device pixel ratio, or something similar?
>
> See attached screenshots, expanding to full rez before viewing. Note smoothness of retina button pixmaps at left VS jagged lines in middle.
>
> I am using a QOpenGLWidget for the viewport (though this doesn’t seem to matter):

I vaguely remember that anti-aliasing doesn't work with an OpenGL view
(that was on a Linux machine).

> view.setViewport(QOpenGLWidget())

Don't do that and the anti-aliasing will work.

Chris



>
> I am painting QPainterPaths like this:
>
> def paint(self, painter, option, widget):
>     painter.save()
>     painter.setPen(self.pen)
>     painter.setBrush(self.brush)
>     painter.drawPath(self.path)
>     painter.restore()
>
> with the following render hints:
>
> view.setRenderHints(QPainter.Antialiasing|QPainter.HighQualityAntialiasing|QPainter.SmoothPixmapTransform|QPainter.TextAntialiasing)
>
> and the following attribute set on the QApplication:
>
> app.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
>
> Thanks!
> -P
>
>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>



More information about the Interest mailing list