PDA

View Full Version : Zooming an image to the center



A9am
2nd November 2011, 05:01
Hai,

I have a QLabel and in that an image. I want to zoom the image to the center using mouse.How can I do this?


Thanks.

sergio87
2nd November 2011, 08:54
Hi!

You can see the QT example ImageViewer (http://doc.qt.nokia.com/latest/widgets-imageviewer-imageviewer-cpp.html). This example zoom the image to the center of the scroll bar. I don't know how can you center on the mouse position with QLabel.

I center on the mouse position (google maps like) with QGrapthicsView (http://doc.qt.nokia.com/latest/widgets-imageviewer-imageviewer-cpp.html) and QGraphicsScene (http://doc.qt.nokia.com/latest/qgraphicsscene.html). My code is based on the QT example sgvViewer (http://doc.qt.nokia.com/stable/painting-svgviewer.html).

I hope it help you. :p