I can paint a QPixmap
just fine:
QPainter painter;
painter.drawPixmap(x, y, w, h, my_pixmap);
And I can also draw a circle with:
painter.drawArc(x, y, w, h, a, alen);
Now I want to combine these two; my pixmap might not always be a circle (=transparent corners) so I can't just paint the whole pixmap on the screen. This means that I need to paint only the center of my pixmap.
Here's an image to make it more clear:
Is this possible?
Yes, you should be able to do this by setting a clip path on the painter. Something like this should work:
QPainterPath path;
path.addEllipse(x, y, w, h);
painter.setClipPath(path);
painter.drawPixmap(x, y, w, h, my_pixmap);