两幅QImage怎么拼接?

QImage qimg3 = QImage(qimg1.width(), qimg1.height() * 2, QImage::Format_RGB888);
QPainter p(&qimg3);
p.drawPixmap(0, 0, qimg1.width(), qimg1.height(), QPixmap::fromImage(qimg1));
p.drawPixmap(0, qimg1.height(), qimg1.width(), qimg1.height(), QPixmap::fromImage(qimg1));
QPixmap pix3 = QPixmap::fromImage(qimg3);
ui->label_dislocation->setPixmap(pix3.scaled(ui->label_dislocation->width(), ui->label_dislocation->height(), Qt::KeepAspectRatio));

 

上一篇:QPainter绘制自定义大小的图片


下一篇:c-为什么QPixmap :: scaled()不起作用?