Fit image into Qlabel
Solved
General and Desktop
-
Hello dear programmers.
Well as the subject says i want to Fit my image in Qlabel but here is the case,
there is scaleContent for that Qlabel that does the Opposite job of fitting an image.
it stretches the image in both vertical and horizontal.
so any idea of how to do the trick?
i used Pixmap not QPicture:QPixmap image(":/new/prefix1/background/main logo_.png"); ui->label->setPixmap(image); [Example of fitting an image](http://s4.img7.ir/xgUvJ.png) ```
-
Hi,
Since you can get the size of the label, you can use QPixmap::scaled to resize the image.
-