[Qt-interest] Best way to zoom an image
Cole, Derek
dcole at integrity-apps.com
Thu Jan 20 19:22:35 CET 2011
Hello,
I have created a label that is containing a Pixmap of an image that is much larger than the label, so I did some work to try to scale the image:
QPixmap p(QPixmap::fromImage(*qi,Qt::AutoColor));
QPixmap p1(p.scaled(ui->viewLabel->width(),ui->viewLabel->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation ));
ui->viewLabel->setPixmap(p1);
ui->viewLabel->setFixedHeight(p1.height());
ui->viewLabel->setFixedWidth(p1.width());
I guess my question is, if I wanted to get that pixmap p1 from the label, with something like "viewLabel->pixmap()", can I now scale that image back to its original size, or have I lost something with the compression to make the smaller image when I first scaled p1?
In other words, if I was to zoom "all the way in" on viewLabel's pixmap, would I then be able to zoom all the way back out and see my full, unaltered image?
If not, what is the best way to do this? I basically want to load my image, and then use the mouse wheel to zoom in and out on the image, always keeping the same level of image quality
Thanks
Derek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110120/ec2c9ef2/attachment.html
More information about the Qt-interest-old
mailing list