PDA

View Full Version : Set the size of a QPixmap object



RogerShen
12th February 2010, 04:14
Hey all, I want to use QPixmap class to show a photo on a label object.
So I code:
QPixmap pixmap;
pixmap.load(fileName);
update();
ui->iconLabel->setPixmap(pixmap);
But the picture size is not the same as iconLabel. I want to scale the size of that picture by keeping aspect ratio(Make it the same size as iconLabel)
How to realize that?Thx~

aamer4yu
12th February 2010, 04:28
QPixmap::scaled

nish
12th February 2010, 10:35
take a look at the picture viewer example that comes with Qt