Dear visitor, welcome to QtForum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
Scaling a Pixmap
Hi dear all friends,
I am writing a board game which the board is a m*n table of marbles.
My problem is scaling the image of the marble to fit each cell's size(Each cell is a QLabel, and I use QPixmap to load the image and send it to the label).
Would you tell me how to do this? (better to say both in Qt3 and Qt4, but any one is also enough)
Thanks & Regards,
Pooria
This post has been edited 3 times, last edit by "j_pooria" (Jan 26th 2007, 8:46pm)
Hi j_pooria,
Have you tried QLabel::setScaledContents (Qt4)?
this should help u out !!
QPixmap pix(:/"path of teh image");
QSize size = label->size();
QPixmap QPixmap::scaled ( size, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation ) const
cheers
Regards
Huzy...
Hi dear friends,
Both of them worked!
Thank you!