Hi,
I want to set rounded corners on a QDialog. Since it is a top-level window, border-radius doesn't work, so I've to do this :
QRegion EnterPinDialog::roundedRect(const QRect& rect, int r)
{
QRegion region;
// middle and borders
region += rect.adjusted(r, 0, -r, 0);
region += rect.adjusted(0, r, 0, -r);
// top left
QRect corner(rect.topLeft(), QSize(r*2, r*2));
region += QRegion(corner, QRegion::Ellipse);
// top right
corner.moveTopRight(rect.topRight());
region += QRegion(corner, QRegion::Ellipse);
// bottom left
corner.moveBottomLeft(rect.bottomLeft());
region += QRegion(corner, QRegion::Ellipse);
// bottom right
corner.moveBottomRight(rect.bottomRight());
region += QRegion(corner, QRegion::Ellipse);
return region;
}
and I call it this way :
this->setMask(roundedRect(this->rect(), 8));
It works, but the problem is that corners are pixelized.
Is there a way to get it without having these pixelized corners ? If yes, how ?