Qt里面,要想画图,只有把画图的过程放入paintEvent()方法中,每次窗口变化时会回调paintEvent() 方法
Paint events are sent to widgets that need to update themselves, for
instance when part of a widget is exposed because a covering widget was
moved.
QPainter
The QPainter class performs low-level painting on widgets and other paint devices.
QPainter 类对象作用于继承QPaintDevice 类的对象
QPaintDevice
QPainter对象可以在QPaintDevice上进行绘画操作
常用的QPaintDevice 子类有QWidget, QPixmap, QImage
示例
//画图并保存为图片
void SomeWidget::painterEvent()
{
QImage image(50,

Qt的Paint系统通过QPaintEvent触发更新,QPainter作为低级别绘画工具在QPaintDevice上作画。QPaintDevice是抽象二维画布,常见子类包括 QWidget。QPaintEngine为不同平台的设备提供绘制接口,但通常对开发者透明。
最低0.47元/天 解锁文章
7125

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



