I only want to resize the QPixmap, not the content.
CodePudding user response:
QPixmap newPixmap(newWidth, newHeight);
newPixmap.fill(Qt::black); // or the color you like... maybe you want Qt::transparent?
QPainter painter(&newPixmap);
painter.drawPixmap(0, 0, oldPixmap);