Yes, use a QPainter to paint into a QPaintDevice, QImage is a QPaintDevice, so it works.
35
votes
QImage srcImage = QImage(100, 100);
QImage destImage = QImage(200, 200);
QPoint destPos = QPoint(25, 25); // The location to draw the source image within the dest
srcImage.fill(Qt::red);
destImage.fill(Qt::white);
QPainter painter(&destImage);
painter.drawImage(destPos, srcImage);
painter.end();
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more