const qreal top = XXX;
const qreal left = XXX;
const qreal bottom = XXX;
const qreal right = XXX;
const qreal xMaxRoundness = XXX;
const qreal yMaxRoundness = XXX;
const qreal roundnessSizeX = qMin((qAbs(right - left) / 2.0), xMaxRoundness);
const qreal roundnessSizeY = qMin((qAbs(top - bottom) / 2.0), yMaxRoundness);
roundedRect.arcTo(left, top,
roundnessSizeX * 2.0, roundnessSizeY * 2.0,
180.0, -90.0);
roundedRect.arcTo(right - roundnessSizeX * 2.0, top,
roundnessSizeX * 2.0, roundnessSizeY * 2.0,
90.0, -90.0);
roundedRect.arcTo(right - roundnessSizeX * 2.0, bottom - roundnessSizeY * 2.0,
roundnessSizeX * 2.0, roundnessSizeY * 2.0,
0.0 , -90.0);
roundedRect.arcTo(leftPosition, bottom - roundnessSizeY * 2.0,
roundnessSizeX * 2.0, roundnessSizeY * 2.0,
-90.0, -90.0);
roundedRect.closeSubpath();
const qreal top = XXX;
const qreal left = XXX;
const qreal bottom = XXX;
const qreal right = XXX;
const qreal xMaxRoundness = XXX;
const qreal yMaxRoundness = XXX;
const qreal roundnessSizeX = qMin((qAbs(right - left) / 2.0), xMaxRoundness);
const qreal roundnessSizeY = qMin((qAbs(top - bottom) / 2.0), yMaxRoundness);
QPainterPath roundedRect(QPointF(left, top - roundnessSizeY));
roundedRect.arcTo(left, top,
roundnessSizeX * 2.0, roundnessSizeY * 2.0,
180.0, -90.0);
roundedRect.arcTo(right - roundnessSizeX * 2.0, top,
roundnessSizeX * 2.0, roundnessSizeY * 2.0,
90.0, -90.0);
roundedRect.arcTo(right - roundnessSizeX * 2.0, bottom - roundnessSizeY * 2.0,
roundnessSizeX * 2.0, roundnessSizeY * 2.0,
0.0 , -90.0);
roundedRect.arcTo(leftPosition, bottom - roundnessSizeY * 2.0,
roundnessSizeX * 2.0, roundnessSizeY * 2.0,
-90.0, -90.0);
roundedRect.closeSubpath();
To copy to clipboard, switch view to plain text mode
Bookmarks