绘图操作
逻辑思路
1、在.h文件中加入画图事件
protected:
void paintEvent(QPaintEvent *);
2、在cpp函数中实现用图画、用笔画、用画刷画三种模式


cpp文件
#include "widget.h"
#include "ui_widget.h"
#include <QPixmap>
#include <QPainter>
#include <QPen>
#include <QBrush>
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
}
Widget::~Widget()
QT绘图详解:用图画、笔画、画刷模式

本文介绍了QT框架中的绘图操作,详细讲解了如何在.h文件中设置画图事件,并在cpp文件中实现用图画、用笔画、用画刷进行绘图的三种模式。
最低0.47元/天 解锁文章
1412

被折叠的 条评论
为什么被折叠?



