其他分享
首页 > 其他分享> > Qt绘图设备QImage

Qt绘图设备QImage

作者:互联网

#include "widget.h"
#include "ui_widget.h"
#include <QPainter>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    /* 绘图设备 */
    QImage img(300, 300, QImage::Format_RGB32);
    img.fill(Qt::lightGray);

    QPainter painter(&img);
    painter.setPen(QPen(Qt::red));
    painter.drawEllipse(QPoint(100, 100), 50, 50);

    ui->label->setPixmap(QPixmap::fromImage(img));
}

标签:Widget,Qt,img,ui,painter,绘图,include,QImage
来源: https://www.cnblogs.com/zhangxuechao/p/16553986.html