【文件属性】:
文件名称:最后更改函数如下-Qt简介包含Qt的系统的架构
文件大小:14.45MB
文件格式:PPT
更新时间:2021-04-24 03:05:27
qt教程
最后更改函数如下:
void Dialog::paintEvent(QPaintEvent *)
{
int x,y,w,h;
x = lastPoint.x();
y = lastPoint.y();
w = endPoint.x() – x;
h = endPoint.y() – y;
QPainter painter(this);
if(isDrawing) //如果正在绘图
{
tempPix = pix; //将以前pix中的内容复制到tempPix中,这样实现了交互绘图
QPainter pp(&tempPix);
pp.drawRect(x,y,w,h);
painter.drawPixmap(0,0,tempPix);
}
else
{
QPainter pp(&pix);
pp.drawRect(x,y,w,h);
painter.drawPixmap(0,0,pix);
}
}