其他分享
首页 > 其他分享> > QT中手动调用画家事件

QT中手动调用画家事件

作者:互联网

QPainter类

 

 

void Widget::paintEvent(QPaintEvent *event)
{

//    QPainter painter(this);   //实例化画家对象,this指定的是绘图设备

//    QPen pen(Qt::red);
//    painter.setPen(pen);

//    QBrush brush(Qt::cyan);
//    brush.setStyle(Qt::Dense7Pattern);
//    painter.setBrush(brush);

//    painter.drawLine(QPoint(0,0),QPoint(100,100));

//    painter.drawEllipse(QPoint(100,100),50,50);

//    painter.drawText(QRect(100,200,200,50),"好好学习,天天向上");


    //--------------------------------
    QPainter painter(this);   //实例化画家对象,this指定的是绘图设备
    painter.drawPixmap(pox,100,QPixmap(":/pikaqiu.gif"));

}

手动调用 用update();

标签:调用,QT,手动,50,QPoint,QPainter,100,painter,Qt
来源: https://www.cnblogs.com/qq376142178/p/15365936.html