Qt:QtPainter画圆角矩形和多边形

#include 
#include 
void MainWindow::paintEvent(QPaintEvent *)
{
    QPainter painter;
    painter.begin(this);

    painter.setPen(Qt::blue);
    QRectF rect(120, 10.0, 80.0, 80.0);
    painter.drawRoundedRect(rect, 20, 20); // round rect

    QPointF p2[3] = {
                    QPointF(120.0, 110.0),
                    QPointF(220.0, 110.0),
                    QPointF(220.0, 190.0)
                    };

    painter.drawPolygon(p2, 3); // drawing shape with points

    painter.end();
}

Qt:QtPainter画圆角矩形和多边形_第1张图片

你可能感兴趣的:(C++)