I have a QLabel which displays an image. Currently, I have the image set to keep it's aspect ratio, and grow as big as it can within the QLabel.
Is there any way I can also set the QLabel to maintain the image's aspect ratio? I do not want to have "blank" QLabel space either side of the image when the label is wider than the image.
I have been looking for any sort of QLabel property that would allow me to set the aspect ratio of the label, but have not managed to get anything to do what I wanted to do.
All the answers I have seen relate to keeping the aspect ratio of a resized QPixmap image, but not of the QLabel containing it.
Any help would be great!
Cheers
FP
setMaximumSize
on the QLabel, setting it to the size of the image. You would have to call it every time there is a resize event. I don't know if there is an easier way. – Mel