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));
}