Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widget) { ui->setupUi(this); /* 绘图设备 专门为平台做了显示的优化 */ QPixmap pixmap(300, 300); pixmap.fill(Qt::lightGray); QPainter painter(&pixmap); painter.setPen(Qt::red); painter.drawEllipse(QPoint(100, 100), 50, 50); ui->label->setPixmap(pixmap); }