protected:
void paintEvent(QPaintEvent*);
void Pet::paintEvent(QPaintEvent*) { //重写自动执行 QPixmap pixmap = QPixmap("./images/background.jpg").scaled(this->size()); QPainter painter(this); painter.drawPixmap(this->rect(), pixmap); //画家画图片 }
标签:pixmap,QT,void,painter,QPaintEvent,背景图片,画家 From: https://www.cnblogs.com/RedWetPlace/p/17101156.html