Qt 画布(基于QImage 以及 QPainterPath)
来源:互联网 发布:国产网络腐剧 编辑:程序博客网 时间:2024/06/05 02:31
Qt 画布(基于QImage 以及 QPainterPath)
QPainterPath:实时记录描绘的轨迹
QImage:画布
具体实现:
- paintEvent:负责重绘画布,及时更新。
- QMouseEvent:鼠标事件,负责动态的将鼠标位置信息记录到QPainterPath中。
- paint:在画布上绘制QPainterPath的每一个图形。
基本流程:
- 鼠标左键点击(1) –> clear the previous path_points and new path(QPainterPath).
- 鼠标左键点击(2) –> set start_point and append it into path_points.
- 鼠标移动事件(1) –> add point into path_points and paint painterPath.
- 鼠标左键释放(1) –> add point into path_points and paint painterPath.
- 鼠标双击事件(1) –> reset current image back to bg_image
- 鼠标右键点击(1) –> save the image with “a.png”
- 重绘事件 –> redraw the image.
效果图:
- 注:QImage为底层青草色画布,黑色笔记是绘制在该画布上的QPainterPath
阅读全文
0 0
- Qt 画布(基于QImage 以及 QPainterPath)
- Qt之图形(QPainterPath)
- Qt之图形(QPainterPath)
- qt绘图 QPainterPath类
- QT QImage使用方法(Qt学习1)
- Qt笔记之绘图QPainterpath
- QPainterPath
- QPainterPath
- QPainterPath
- Qt实用技巧:QPainterPath绘图路径(多次画同样的图形集合)
- Qt的QImage类
- QT QPixmap、QBitmap、QImage
- Qt QImage QPainter
- 【Qt】QImage等坐标系
- QT中QImage类
- QT 之 QImage类
- QT中QImage类
- qt之QImage
- MySQL笔记四
- 蓝牙电路
- 剑指offer-和为s的两个数字VS和为s的连续正数序列
- JVM监控与调优
- http的长连接和短连接
- Qt 画布(基于QImage 以及 QPainterPath)
- MySQL笔记五
- 25个经典的Spring面试问答
- jquery使用积累
- LeetCode_001 求两个数的和
- 总结Android Socket开发中可能遇到的问题
- ac自动机讲解
- 一个简单的Makefile
- C++类 内存对齐和类大小理解