PDA

View Full Version : Zooming an Image to the point where the mouse points



A9am
21st October 2011, 09:00
Hai All,


I am using a QLabel in my application.I have a pixmap image in that label.
I want to zoom the image to the point where the mouse points.Can anyone please help me doing that?


Thanks

totem
21st October 2011, 10:25
QLabel does not really fit the need to 'navigate' in a pixmap. You should consider using GraphicsView API instead (and use QGraphicsView::setTransformationAnchor(QGraphicsVi ew::AnchorUnderMouse) (http://doc.qt.nokia.com/latest/qgraphicsview.html#transformationAnchor-prop) to zoom under mouse cursor)

A9am
21st October 2011, 10:50
Thanks totem for your suggestion. But I dont want to use Graphicsview due to some memory usage issue.Can you please suggest me any other method?

totem
21st October 2011, 11:40
Yes :
Overload QLabel class, reimplement mouseWheel event handler and do some image-processing-code based on your initial picture, the area of the picture currently displayed, the QLabel size and QCursor::pos(), and you got it.

A9am
24th October 2011, 07:20
I want to drag an image using mouse in QLabel.Can anyone please tell me which class to use for that?

Spitfire
24th October 2011, 11:26
I don't think you'll be able to do something like that with QLabel alone and if you do - it will require a lot of unnecesary complexity.

Take a look at those link, I guess that's what you're looking for:
http://doc.qt.nokia.com/stable/widgets-imageviewer.html
http://qt4.digitalfanatics.org/articles/zoomer.html
http://doc.trolltech.com/4.3/widgets-imageviewer-imageviewer-cpp.html

A9am
4th November 2011, 06:51
Can anyone please tell me how to zoom image to the mouse point in QLabel by getting the Qpoint of mouse??