最后更改函数如下-QT界面设计

时间:2021-04-26 09:31:31
【文件属性】:
文件名称:最后更改函数如下-QT界面设计
文件大小:13.53MB
文件格式:PPT
更新时间:2021-04-26 09:31:31
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);     } }

网友评论