Important: Please read the Qt Code of Conduct -

QPainter Transformation & Non-Solid Brushes

  • Hi!

    I am using a transformed QPainter to draw some filled polygons with a non-solid brush style (e.g. Qt::Dense1Pattern). The painter gets transformed according to the zoom factor, the translation and the rotation chosen by the user. The scene is drawn in the paint method of a QQuickPaintedItem derived class using 'Image' as render target. Unfortunately, aliasing artifacts appear within the filled polygons, when the user zooms in and out.

    Zoom level without artifacts:

    ! artifacts)!

    Zoom level with artifacts:


    It seems, that the artifacts are caused by the transformation of the brush .

    The first workaround, that came into my mind, was to set the inverse transformation of the painter on the brush. Doing it this way, the orientation of the fill pattern stays the same when the view gets rotated but this is neglectable at the moment.

    Is there a better solution for this problem than setting the inverse transformation on the brush?

  • Lifetime Qt Champion


    This question might be revealing a bug, I think you should bring it to the interest mailing list (you'll find there Qt's developers/maintainers, this forum is more user oriented).

  • Thank you for the tip, I'll give that a try.


Log in to reply