但是我看到一些例子中可以不用重新绘制整个界面,而是通过传递参数只画出改变的地方
如Qt tutorial chapter 11 中的
void CannonField::moveShot()
{
QRegion region = shotRect();
++timerCount;
QRect shotR = shotRect();
if (shotR.x() > width() || shotR.y() > height()) {
autoShootTimer->stop();
} else {
region = region.unite(shotR);
}
update(region);
}
另外我也不明白为什么要用region,我试着将region换成shotRect(),结果轨迹变成一条线而不是原来的移动的点
请大侠指导