How to maintain aspect ratio of a Qlabel throughly??
vasu_gupta last edited by vasu_gupta
I have a Qlabel in which I want to load a qimage(658x492) , now i have loaded this image in the qlabel like this:
QPixmap image("/home/vasu/IMG0231.jpg"); image.scaled(ui->IMAGE_CAM->width(),ui->IMAGE_CAM->height(),Qt::KeepAspectRatio); ui->IMAGE_CAM->setPixmap(image);
for now the aspect ratio is maintained by the Qlabel, however when i maximize or minimize my gui ithe aspect ratio of Qlabel doesent hold,like when i maximize it becomes 662x492
In my code i have to select the roi on the qlabel which should precisely correspond to the input image and send it to a function for doing some processing.
This require great precision(1-2 pix) thus i cannot afford to mess up the aspect ratio .
how can i do that