QT4 编译出错 代码如下 求高手指导
voidCannonField::paintEvent(QPaintEvent*e){if(!e->rect().intersects(cannonRect()))ret...
void CannonField::paintEvent(QPaintEvent *e)
{
if( !e->rect().intersects(cannonRect()))
return;
QRect cr=cannonRect();
QPixmap pix(cr.size());
pix.fill(this,cr.topRight());
QPainter painter (&pix);
painter.setRenderHint(QPainter::Antialiasing,true);
painter.setPen(QPen(Qt::blue));
painter.setBrush(QBrush(QBrush(Qt::blue)));
painter.translate(0,pix.height()-1);
painter.drawPie(QRect(-35,-35,70,70),0,90*16);
painter.rotate(-currentAngle);
painter.drawRect(33,-4,15,8);
painter.end();
painter.begin(this);
painter.drawPixmap(cr.topLeft(),pix);
QRect updateR = e->rect();
QPainter p( this );
if ( updateR.intersects( cannonRect() ) )
paintCannon( &p );
if ( autoshoottimer->isActive() && updateR.intersects( shotRect() ) )
paintShot( &p );
}
void CannonField::paintEvent( QPaintEvent *e )
{ QRect updateR = e->rect();
QPainter p( this );
if ( updateR.intersects( cannonRect() ) )
paintCannon( &p );
if ( autoshoottimer->isActive() && updateR.intersects( shotRect() ) )
paintShot( &p );
} 展开
{
if( !e->rect().intersects(cannonRect()))
return;
QRect cr=cannonRect();
QPixmap pix(cr.size());
pix.fill(this,cr.topRight());
QPainter painter (&pix);
painter.setRenderHint(QPainter::Antialiasing,true);
painter.setPen(QPen(Qt::blue));
painter.setBrush(QBrush(QBrush(Qt::blue)));
painter.translate(0,pix.height()-1);
painter.drawPie(QRect(-35,-35,70,70),0,90*16);
painter.rotate(-currentAngle);
painter.drawRect(33,-4,15,8);
painter.end();
painter.begin(this);
painter.drawPixmap(cr.topLeft(),pix);
QRect updateR = e->rect();
QPainter p( this );
if ( updateR.intersects( cannonRect() ) )
paintCannon( &p );
if ( autoshoottimer->isActive() && updateR.intersects( shotRect() ) )
paintShot( &p );
}
void CannonField::paintEvent( QPaintEvent *e )
{ QRect updateR = e->rect();
QPainter p( this );
if ( updateR.intersects( cannonRect() ) )
paintCannon( &p );
if ( autoshoottimer->isActive() && updateR.intersects( shotRect() ) )
paintShot( &p );
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询