Reputation: 1620
I have a QLabel that is loaded with a pixmap. I have it set so that when the window/QLlabel is resized, the image of the qlabel resizes as well. However, when I try to save the image and retrieve the pixmap, it is the original loaded. How would I go about retrieving the newly resized image from the QLabel and retrieving it as a QImage?
Upvotes: 1
Views: 1162
Reputation: 3094
On the resize event of your label, Use
Label->setPixmap(QPixmap::fromImage(YourImage).scaled(ui->Label->size(), Qt::IgnoreAspectRatio));
For getting image as size of image use
Label->pixmap().toImage();
if this image is still not the same size as of label, Try
Label->pixmap().toImage().scaled(Label->size(), Qt::IgnoreAspectRatio));
Upvotes: 1