Embed an image inside a widget
-
Hi guys.
I want to visualize an entire image inside a widget (for example inside a label) without losing information. I suppose I will need to do a process of deforming the image so that I can enter it completely or I do not know if Qt already brings something to do this kind of tasks.
Thank you
-
Hi,
What do you mean by without losing information ?
If you mean keep the full image but scaled then QImage::scaled is your friend. -
@SGaist Thanks for answering. Maybe I have not explained myself completely well. I have an image with a certain size and I need to embed it in a polygon with four vertex without cropping the image. The entire image must be displayed in the polygon.
-
@Gojir4 said in Embed an image inside a widget:
@PinTxO Use QImage::scaled as suggested by @SGaist with ratio mode set to
Qt::KeepAspectRatio
And what QSize I give to the scaled method if the image I have to insert it in a polygon and not in a rectangle? A trapezium for example. I need to distort the image.