Rotate QBrush Texture Pattern
-
You can match the rotation of the rectangle and the brush with its setTransform() method, but it might be easier to just set the painter transform and let it transform the rectangle and the brush in one go. Something like:
QPainter p(whatever); QBrush b(QPixmap("something.png")); p.save(); p.translate(rect_x, rect_y); p.rotate(angle); QRect r(0, 0, rect_width, rect_height); p.fillRect(r, b); p.restore();
The
save()/restore()
calls are there to preserve the original transform and are only needed if you want to use that painter for something else too.