<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QLabel QPixmap Antialiasing]]></title><description><![CDATA[<p dir="auto">Hi, Guys!<br />
I am attempting to draw an image with rounded corners in a QLabel. I have tried using QPainter to draw the image and set the QPainter::Antialiasing property in an effort to eliminate the jagged edges of the corners, but it doesn't seem to be working. Here is my code:</p>
<pre><code>QPixmap QLabelUtils::pixmapToRound(QPixmap&amp; src, int x, int y, int width, int height, int radius) {
    if (src.isNull()) {
        return QPixmap();
    }

    QSize size(width, height);
    QBitmap mask(size);
    QPainter painter(&amp;mask);
    painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform);
    painter.fillRect(x, y, size.width(), size.height(), Qt::white);
    painter.setBrush(QColor(0, 0, 0));

    QPainterPath path;
    path.addRoundedRect(x, y, size.width()-1, size.height()-1, radius, radius);
    path.translate(0.5, 0.5);
    painter.drawPath(path);

    QPixmap image = src.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    image.setMask(mask);
    return image;
}
</code></pre>
<p dir="auto">my Qt version is 6.4.<br />
Please help me solve this problem, it's really bothering me. Thank you very much.</p>
]]></description><link>https://forum.qt.io/topic/144489/qlabel-qpixmap-antialiasing</link><generator>RSS for Node</generator><lastBuildDate>Sat, 17 Oct 2026 02:22:49 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/144489.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Apr 2023 02:55:24 GMT</pubDate><ttl>60</ttl></channel></rss>